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 | b14c342bd5233348237cf1239c795045ee7612bc (patch) | |
tree | 16d0855b79dd2be30006259ef7d1d9e5799a334e /lib/System/Unix | |
parent | 8d8a7ffe580c622e7e43f1426bca64e517de0d06 (diff) | |
download | external_llvm-b14c342bd5233348237cf1239c795045ee7612bc.zip external_llvm-b14c342bd5233348237cf1239c795045ee7612bc.tar.gz external_llvm-b14c342bd5233348237cf1239c795045ee7612bc.tar.bz2 |
no need to do a stat then an lstat. lstat will tell us if normal files don't exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29068 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix')
-rw-r--r-- | lib/System/Unix/Path.inc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index 2da76e8..4ca4753 100644 --- a/lib/System/Unix/Path.inc +++ b/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); } |