Skip to content

Commit

Permalink
Revert "win, fs: use FILE_WRITE_ATTRIBUTES when opening files"
Browse files Browse the repository at this point in the history
This reverts commit aa1beaa.
This commit was causing EPERM errors in Node.js.

Fixes: nodejs/node#20112
PR-URL: libuv#1800
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
  • Loading branch information
cjihrig committed Apr 18, 2018
1 parent 0aa4ed0 commit 1954e9e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
2 changes: 0 additions & 2 deletions src/win/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ void fs__open(uv_fs_t* req) {
access |= FILE_APPEND_DATA;
}

access |= FILE_WRITE_ATTRIBUTES;

/*
* Here is where we deviate significantly from what CRT's _open()
* does. We indiscriminately use all the sharing modes, to match
Expand Down
22 changes: 0 additions & 22 deletions test/test-fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1367,28 +1367,6 @@ TEST_IMPL(fs_chmod) {

check_permission("test_file", 0600);

#ifdef _WIN32
/* Test clearing read-only flag from files with Archive flag cleared */
/* Make the file read-only and clear archive flag */
r = SetFileAttributes("test_file", FILE_ATTRIBUTE_READONLY);
ASSERT(r != 0);
check_permission("test_file", 0400);

r = uv_fs_open(NULL, &req, "test_file", 0, 0, NULL);
ASSERT(r >= 0);
ASSERT(req.result >= 0);
uv_fs_req_cleanup(&req);

r = uv_fs_fchmod(NULL, &req, file, 0600, NULL);
ASSERT(r == 0);
ASSERT(req.result == 0);
uv_fs_req_cleanup(&req);

check_permission("test_file", 0600);
/* Restore Archive flag for rest of the tests */
r = SetFileAttributes("test_file", FILE_ATTRIBUTE_ARCHIVE);
ASSERT(r != 0);
#endif
#ifndef _WIN32
/* async chmod */
{
Expand Down

0 comments on commit 1954e9e

Please sign in to comment.