Skip to content
Browse files

Windows: skip GetFileAttributes call when opening a file

It wasn't working, and everything seemed to work fine nonetheless. Removing it just saves a syscall.
  • Loading branch information...
1 parent b750dec commit 436589692148a87d1d0e55d2641288a4fe913b22 @piscisaureus piscisaureus committed
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/win/fs.c
View
6 src/win/fs.c
@@ -224,10 +224,8 @@ void fs__open(uv_fs_t* req, const wchar_t* path, int flags, int mode) {
goto end;
}
- /* Figure out whether path is a file or a directory. */
- if (GetFileAttributesW(path) & FILE_ATTRIBUTE_DIRECTORY) {
- attributes |= FILE_FLAG_BACKUP_SEMANTICS;
- }
+ /* Setting this flag makes it possible to open a directory. */
+ attributes |= FILE_FLAG_BACKUP_SEMANTICS;
file = CreateFileW(path,
access,

0 comments on commit 4365896

Please sign in to comment.
Something went wrong with that request. Please try again.