diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2016-10-26 14:34:34 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2016-10-26 14:34:34 +0100 |
commit | b4e7e6bf229664045926633aae90a287e39f6454 (patch) | |
tree | 2b9f8999fa61bd811f60c2f4187322c6b71fcc43 /libstdc++-v3/src | |
parent | 09844a5f640d7e881f503859953925ae260a2be8 (diff) | |
download | gcc-b4e7e6bf229664045926633aae90a287e39f6454.zip gcc-b4e7e6bf229664045926633aae90a287e39f6454.tar.gz gcc-b4e7e6bf229664045926633aae90a287e39f6454.tar.bz2 |
Fix error handling in recursive_directory_iterator::increment
* src/filesystem/dir.cc (recursive_directory_iterator::increment):
Reset state on error.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Check state after increment error.
From-SVN: r241552
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/filesystem/dir.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libstdc++-v3/src/filesystem/dir.cc b/libstdc++-v3/src/filesystem/dir.cc index 4640d75..bcd7dd0 100644 --- a/libstdc++-v3/src/filesystem/dir.cc +++ b/libstdc++-v3/src/filesystem/dir.cc @@ -343,7 +343,10 @@ fs::recursive_directory_iterator::increment(error_code& ec) noexcept { _Dir dir = open_dir(top.entry.path(), _M_options, &ec); if (ec) - return *this; + { + _M_dirs.reset(); + return *this; + } if (dir.dirp) _M_dirs->push(std::move(dir)); } |