[llvm-commits] CVS: llvm/lib/System/Unix/Path.inc
Chris Lattner
lattner at cs.uiuc.edu
Fri Jul 7 14:21:18 PDT 2006
Changes in directory llvm/lib/System/Unix:
Path.inc updated: 1.44 -> 1.45
---
Log message:
no need to do a stat then an lstat. lstat will tell us if normal files don't exist.
---
Diffs of the changes: (+4 -7)
Path.inc | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
Index: llvm/lib/System/Unix/Path.inc
diff -u llvm/lib/System/Unix/Path.inc:1.44 llvm/lib/System/Unix/Path.inc:1.45
--- llvm/lib/System/Unix/Path.inc:1.44 Thu Jul 28 11:25:57 2005
+++ llvm/lib/System/Unix/Path.inc Fri Jul 7 16:21:06 2006
@@ -453,14 +453,11 @@
for ( ; de != 0; de = ::readdir(direntries)) {
if (de->d_name[0] != '.') {
Path aPath(dirPath + (const char*)de->d_name);
- struct stat buf;
- if (0 != stat(aPath.path.c_str(), &buf)) {
- int stat_errno = errno;
- struct stat st;
- if (0 == lstat(aPath.path.c_str(), &st) && S_ISLNK(st.st_mode))
+ struct stat st;
+ if (0 != lstat(aPath.path.c_str(), &st)) {
+ if (S_ISLNK(st.st_mode))
continue; // dangling symlink -- ignore
- ThrowErrno(aPath.path +
- ": can't determine file object type", stat_errno);
+ ThrowErrno(aPath.path + ": can't determine file object type");
}
result.insert(aPath);
}
More information about the llvm-commits
mailing list