From 3c61888dda26e5f02d7d0c9ea8eaf9f39bdc12e5 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Tue, 17 Apr 2018 20:02:15 -0400 Subject: [PATCH] Revert "win, fs: use FILE_WRITE_ATTRIBUTES when opening files" This reverts commit aa1beaa07c3c8fc7531055412728c8bf691e118e. This commit was causing EPERM errors in Node.js. Fixes: https://github.com/nodejs/node/issues/20112 --- src/win/fs.c | 2 -- test/test-fs.c | 22 ---------------------- 2 files changed, 24 deletions(-) diff --git a/src/win/fs.c b/src/win/fs.c index b07d47cf56be..30b87ac51549 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -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 diff --git a/test/test-fs.c b/test/test-fs.c index 0075a02be663..000a151a64ee 100644 --- a/test/test-fs.c +++ b/test/test-fs.c @@ -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 */ {