Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 35e8f26

Browse filesBrowse files
anonrigRafaelGSS
authored andcommitted
fs: throw fchownSync error from c++
PR-URL: #51075 Refs: nodejs/performance#106 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 9b7f79a commit 35e8f26
Copy full SHA for 35e8f26

File tree

Expand file treeCollapse file tree

3 files changed

+7
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+7
-11
lines changed
Open diff view settings
Collapse file

‎lib/fs.js‎

Copy file name to clipboardExpand all lines: lib/fs.js
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,9 +2051,7 @@ function fchownSync(fd, uid, gid) {
20512051
validateInteger(uid, 'uid', -1, kMaxUserId);
20522052
validateInteger(gid, 'gid', -1, kMaxUserId);
20532053

2054-
const ctx = {};
2055-
binding.fchown(fd, uid, gid, undefined, ctx);
2056-
handleErrorFromBinding(ctx);
2054+
binding.fchown(fd, uid, gid);
20572055
}
20582056

20592057
/**
Collapse file

‎src/node_file.cc‎

Copy file name to clipboardExpand all lines: src/node_file.cc
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2590,17 +2590,15 @@ static void FChown(const FunctionCallbackInfo<Value>& args) {
25902590
CHECK(IsSafeJsInt(args[2]));
25912591
const uv_gid_t gid = static_cast<uv_gid_t>(args[2].As<Integer>()->Value());
25922592

2593-
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
2594-
if (req_wrap_async != nullptr) { // fchown(fd, uid, gid, req)
2593+
if (argc > 3) { // fchown(fd, uid, gid, req)
2594+
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
25952595
FS_ASYNC_TRACE_BEGIN0(UV_FS_FCHOWN, req_wrap_async)
25962596
AsyncCall(env, req_wrap_async, args, "fchown", UTF8, AfterNoArgs,
25972597
uv_fs_fchown, fd, uid, gid);
2598-
} else { // fchown(fd, uid, gid, undefined, ctx)
2599-
CHECK_EQ(argc, 5);
2600-
FSReqWrapSync req_wrap_sync;
2598+
} else { // fchown(fd, uid, gid)
2599+
FSReqWrapSync req_wrap_sync("fchown");
26012600
FS_SYNC_TRACE_BEGIN(fchown);
2602-
SyncCall(env, args[4], &req_wrap_sync, "fchown",
2603-
uv_fs_fchown, fd, uid, gid);
2601+
SyncCallAndThrowOnError(env, &req_wrap_sync, uv_fs_fchown, fd, uid, gid);
26042602
FS_SYNC_TRACE_END(fchown);
26052603
}
26062604
}
Collapse file

‎typings/internalBinding/fs.d.ts‎

Copy file name to clipboardExpand all lines: typings/internalBinding/fs.d.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ declare namespace InternalFSBinding {
8181
function fchmod(fd: number, mode: number, usePromises: typeof kUsePromises): Promise<void>;
8282

8383
function fchown(fd: number, uid: number, gid: number, req: FSReqCallback): void;
84-
function fchown(fd: number, uid: number, gid: number, req: undefined, ctx: FSSyncContext): void;
84+
function fchown(fd: number, uid: number, gid: number): void;
8585
function fchown(fd: number, uid: number, gid: number, usePromises: typeof kUsePromises): Promise<void>;
8686

8787
function fdatasync(fd: number, req: FSReqCallback): void;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.