Permalink
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 cb58a56 commit bc4126bfaae6b161a961a2b18d2bc911d4685824 @piscisaureus piscisaureus committed May 4, 2012
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/win/fs.c
View
@@ -248,10 +248,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 bc4126b

Please sign in to comment.