Boost logo

Boost :

From: Ben Hutchings (ben_at_[hidden])
Date: 2004-12-12 16:42:39

I noticed that Boost.Filesystem doesn't use readdir_r to iterate over
directories, even if it is available, making that non-thread-safe.
There is a comment to this effect in operations_posix_windows.cpp.

I've attached a patch that I believe will allow it to detect whether
readdir_r is available and to use it iff it is. I have only tested this
on Linux with g++ 3.3, but I tried deliberately breaking the declaration
of readdir_r and verified that the code continues to work without it.

On a visual inspection some time back I also noted that there's no
special handling for empty root directories on Windows. The problem
with these is that while even an empty directory normally has entries
for "." and "..", so that FindFirstFile can return something, root
directories on FAT volumes (and I think NTFS as well) do not have these
and Windows doesn't fake them, so FindFirstFile on an empty root returns
INVALID_HANDLE_VALUE. Note that this only applies to real root
directories, not to the roots of drives that are mapped to
sub-directories using subst or file sharing. I never got round to
checking whether the Boost code actually handles this or not, as I only
use Windows at work and we don't use Boost.Filesystem there. Perhaps
someone could check that out? Unfortunately it's impractical to test
automatically, as empty volumes are hard to generate on demand!


Ben Hutchings
DNRC Motto:  I can please only one person per day.
Today is not your day.  Tomorrow isn't looking good either.

Boost list run by bdawes at, gregod at, cpdaniel at, john at