diff options
author | Chris Lattner <sabre@nondot.org> | 2006-07-07 21:21:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-07-07 21:21:06 +0000 |
commit | 0b2890e3906a43161111db03c7d7e2ed21b34afe (patch) | |
tree | d24d72f201ab801972c421aa4351f5363a317df4 /llvm/lib | |
parent | 546436c482d5af62b2f36f6cd80676f854c93757 (diff) | |
download | bcm5719-llvm-0b2890e3906a43161111db03c7d7e2ed21b34afe.tar.gz bcm5719-llvm-0b2890e3906a43161111db03c7d7e2ed21b34afe.zip |
no need to do a stat then an lstat. lstat will tell us if normal files don't exist.
llvm-svn: 29068
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/System/Unix/Path.inc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index 2da76e8ad13..4ca4753962f 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/lib/System/Unix/Path.inc @@ -453,14 +453,11 @@ Path::getDirectoryContents(std::set<Path>& result) const { 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); } |