Fix a bug in fs::recursive_directory_iterator()

The 4th element of directory_iterator() controls if it should advance to
the first non special directory entry (not . nor ..).

If m_iter advances itself and m_iter->path() is a directory then the next
call to recursive_directory_iterator.increment() will not step down into
this directory.
pull/1116/head
Hleb Valoshka 2021-09-05 22:38:14 +04:00
parent 6f666280fd
commit a2a67c59e8
1 changed files with 2 additions and 1 deletions

View File

@ -367,7 +367,8 @@ recursive_directory_iterator::recursive_directory_iterator(const path& p, direct
if (m_dirs == nullptr)
m_dirs = std::shared_ptr<DirStack>(new DirStack);
m_iter = directory_iterator(p, options, ec);
m_iter = directory_iterator(p, options, ec, false);
__increment(ec); // advance to the first element
if (m_iter == end(m_iter))
reset();