Skip to content

Commit 187fb83

Browse files
committed
fixup! fs: improve error performance of chownSync
1 parent 57a85d9 commit 187fb83

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

benchmark/fs/bench-chownSync.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ const fs = require('fs');
55
const tmpdir = require('../../test/common/tmpdir');
66
tmpdir.refresh();
77

8+
// Windows does not have `getuid` or `getgid`.
9+
if (process.platform === 'win32') {
10+
return;
11+
}
12+
813
const tmpfile = tmpdir.resolve(`.existing-file-${process.pid}`);
914
fs.writeFileSync(tmpfile, 'this-is-for-a-benchmark', 'utf8');
1015

src/node_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2757,7 +2757,7 @@ static void ChownSync(const FunctionCallbackInfo<Value>& args) {
27572757
const uv_gid_t gid = static_cast<uv_gid_t>(args[2].As<Integer>()->Value());
27582758

27592759
uv_fs_t req;
2760-
auto make = OnScopeLeave([&req]() { uv_fs_req_cleanup(&req); });
2760+
auto cleanup = OnScopeLeave([&req]() { uv_fs_req_cleanup(&req); });
27612761
FS_SYNC_TRACE_BEGIN(chown);
27622762
int err = uv_fs_chown(nullptr, &req, *path, uid, gid, nullptr);
27632763
FS_SYNC_TRACE_END(chown);

0 commit comments

Comments
 (0)