[libcxx] r337768 - Handle DT_UNKNOWN correctly during directory iteration.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 23 15:58:47 PDT 2018
Author: ericwf
Date: Mon Jul 23 15:58:46 2018
New Revision: 337768
URL: http://llvm.org/viewvc/llvm-project?rev=337768&view=rev
Log:
Handle DT_UNKNOWN correctly during directory iteration.
Unlike stat and lstat, where unknown really means we know it's something weird,
during directory iteration DT_UNKNOWN simply means that the underlying FS doesn't
support the dirent::dt_type field.
This patch fixes libc++ to correctly set the cache to empty when DT_UNKNOWN is reported.
Modified:
libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp
Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337768&r1=337767&r2=337768&view=diff
==============================================================================
--- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Mon Jul 23 15:58:46 2018
@@ -42,8 +42,11 @@ static file_type get_file_type(DirEntT *
return file_type::regular;
case DT_SOCK:
return file_type::socket;
+ // Unlike in lstat, hitting "unknown" here simply means that the underlying
+ // filesystem doesn't support d_type. Report is as 'none' so we correctly
+ // set the cache to empty.
case DT_UNKNOWN:
- return file_type::unknown;
+ break;
}
return file_type::none;
}
More information about the cfe-commits
mailing list