Skip to content

Commit

Permalink
Fix a bug in fs::recursive_directory_iterator()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
375gnu committed Sep 6, 2021
1 parent 6f66628 commit a2a67c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/celcompat/fs.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit a2a67c5

Please sign in to comment.