mirror of
https://github.com/boostorg/filesystem.git
synced 2025-05-12 13:41:47 +00:00
Another process could replace the directory being processed by remove_all with a symlink after remove_all called symlink_status but before it creates a directory iterator. As a result, remove_all would remove the linked directory contents instead of removing the symlink. On POSIX systems that support fdopendir and O_NOFOLLOW flag for open(2), this can be prevented by opening the directory with O_NOFOLLOW before iterating. This will fail if the directory was replaced with a symlink. No protection on other systems. Reported in https://github.com/boostorg/filesystem/issues/224.