mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-17 08:36:52 +00:00
no need to do a stat then an lstat. lstat will tell us if normal files don't exist.
llvm-svn: 29068
This commit is contained in:
parent
cb66ae964e
commit
0438b0c461
@ -453,14 +453,11 @@ Path::getDirectoryContents(std::set<Path>& result) const {
|
|||||||
for ( ; de != 0; de = ::readdir(direntries)) {
|
for ( ; de != 0; de = ::readdir(direntries)) {
|
||||||
if (de->d_name[0] != '.') {
|
if (de->d_name[0] != '.') {
|
||||||
Path aPath(dirPath + (const char*)de->d_name);
|
Path aPath(dirPath + (const char*)de->d_name);
|
||||||
struct stat buf;
|
struct stat st;
|
||||||
if (0 != stat(aPath.path.c_str(), &buf)) {
|
if (0 != lstat(aPath.path.c_str(), &st)) {
|
||||||
int stat_errno = errno;
|
if (S_ISLNK(st.st_mode))
|
||||||
struct stat st;
|
|
||||||
if (0 == lstat(aPath.path.c_str(), &st) && S_ISLNK(st.st_mode))
|
|
||||||
continue; // dangling symlink -- ignore
|
continue; // dangling symlink -- ignore
|
||||||
ThrowErrno(aPath.path +
|
ThrowErrno(aPath.path + ": can't determine file object type");
|
||||||
": can't determine file object type", stat_errno);
|
|
||||||
}
|
}
|
||||||
result.insert(aPath);
|
result.insert(aPath);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user