Fix directory_iterator handling of DT_UNKNOWN
authorJonathan Wakely <jwakely@redhat.com>
Fri, 5 Apr 2019 16:56:18 +0000 (17:56 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 5 Apr 2019 16:56:18 +0000 (17:56 +0100)
commit5ed5c0da8ba2491d765ecb260e1babaa83a38b12
treea63eb67092d3a7108921708e92aa5568ddf6fbf9
parentd96f11a2720c8ddfc3d181b181cfaadd888323cd
Fix directory_iterator handling of DT_UNKNOWN

We need to handle DT_UNKNOWN earlier, not only during directory
recursion, so that the cached file_type value in the directory_entry
won't be used.

* src/c++17/fs_dir.cc (_Dir::advance(bool, error_code&)): Handle
d_type == DT_UNKNOWN immediately.
(_Dir::should_recurse(bool, error_code&)): Remove file_type::unknown
handling here.
* testsuite/27_io/filesystem/iterators/caching.cc: New test.

From-SVN: r270172
libstdc++-v3/ChangeLog
libstdc++-v3/src/c++17/fs_dir.cc
libstdc++-v3/testsuite/27_io/filesystem/iterators/caching.cc [new file with mode: 0644]