-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed file_size and is_empty for symlinks on Windows. Reworked is_empty.
GetFileAttributesExW that was used to implement file_size and is_empty on Windows returns information about the symlink rather than the file the symlink refers to. Fix this by opening the file and using GetFileInformationByHandle to obtain the file size and attributes. Additionally, reworked is_empty implementation to reuse the file handle (and fd on POSIX systems) to create the directory iterator if the operation is invoked on a directory. On POSIX systems, implement a more lightweight version of is_empty_directory when readdir is safe to use. Reusing the file handle/fd improves protection against filesystem races, when the file that is being tested by is_empty is initially a directory and then, when we create a directory iterator, it is not. Fixes #313.
- Loading branch information
Showing
4 changed files
with
315 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.