diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-07-23 22:40:41 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-07-23 22:40:41 +0000 |
commit | f96de0296023ef936d62191803ecb48622e6b085 (patch) | |
tree | 172158b703b80d74a8a2686fb1b18ef32f2e96b0 /libcxx/src/experimental/filesystem | |
parent | 82d975afa095669a52a2b9cf092d255b7c4b96e4 (diff) | |
download | bcm5719-llvm-f96de0296023ef936d62191803ecb48622e6b085.tar.gz bcm5719-llvm-f96de0296023ef936d62191803ecb48622e6b085.zip |
Recommit "Use possibly cached directory entry values when performing recursive directory iteration."
The initial patch didn't correctly handle systems when the dirent struct
didn't provide the d_type member. Specifically it set the cache to the incorrect state,
and claimed it was partially populated.
The updated version of this change correctly handles setting up the
cache when the file type is not known (aka file_type::none).
llvm-svn: 337765
Diffstat (limited to 'libcxx/src/experimental/filesystem')
-rw-r--r-- | libcxx/src/experimental/filesystem/directory_iterator.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libcxx/src/experimental/filesystem/directory_iterator.cpp b/libcxx/src/experimental/filesystem/directory_iterator.cpp index a6f10d07565..c95ebc8ac34 100644 --- a/libcxx/src/experimental/filesystem/directory_iterator.cpp +++ b/libcxx/src/experimental/filesystem/directory_iterator.cpp @@ -47,9 +47,10 @@ static file_type get_file_type(DirEntT *ent, int) { } return file_type::none; } + template <class DirEntT> static file_type get_file_type(DirEntT *ent, long) { - return file_type::unknown; + return file_type::none; } static pair<string_view, file_type> @@ -359,13 +360,13 @@ bool recursive_directory_iterator::__try_recursion(error_code *ec) { bool skip_rec = false; error_code m_ec; if (!rec_sym) { - file_status st = curr_it.__entry_.symlink_status(m_ec); + file_status st(curr_it.__entry_.__get_sym_ft(&m_ec)); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || is_symlink(st) || !is_directory(st)) skip_rec = true; } else { - file_status st = curr_it.__entry_.status(m_ec); + file_status st(curr_it.__entry_.__get_ft(&m_ec)); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || !is_directory(st)) |