GeezerVison is showing github.com — fs: throw fchownSync error from c++ · nodejs/node@35e8f26
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/fs.js +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2051,9 +2051,7 @@ function fchownSync(fd, uid, gid) { | 2051 | 2051 | validateInteger(uid, 'uid', -1, kMaxUserId); | 2052 | 2052 | validateInteger(gid, 'gid', -1, kMaxUserId); | 2053 | 2053 |
| 2054 | | - const ctx = {}; | 2055 | | - binding.fchown(fd, uid, gid, undefined, ctx); | 2056 | | - handleErrorFromBinding(ctx); | | 2054 | + binding.fchown(fd, uid, gid); | 2057 | 2055 | } | 2058 | 2056 |
| 2059 | 2057 | /** | |
Collapse file Copy file name to clipboardExpand all lines: src/node_file.cc +5-7Lines changed: 5 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2590,17 +2590,15 @@ static void FChown(const FunctionCallbackInfo<Value>& args) { | 2590 | 2590 | CHECK(IsSafeJsInt(args[2])); | 2591 | 2591 | const uv_gid_t gid = static_cast<uv_gid_t>(args[2].As<Integer>()->Value()); | 2592 | 2592 |
| 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); | 2595 | 2595 | FS_ASYNC_TRACE_BEGIN0(UV_FS_FCHOWN, req_wrap_async) | 2596 | 2596 | AsyncCall(env, req_wrap_async, args, "fchown", UTF8, AfterNoArgs, | 2597 | 2597 | 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"); | 2601 | 2600 | 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); | 2604 | 2602 | FS_SYNC_TRACE_END(fchown); | 2605 | 2603 | } | 2606 | 2604 | } | |
Collapse file Copy file name to clipboardExpand all lines: typings/internalBinding/fs.d.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -81,7 +81,7 @@ declare namespace InternalFSBinding { | 81 | 81 | function fchmod(fd: number, mode: number, usePromises: typeof kUsePromises): Promise<void>; | 82 | 82 |
| 83 | 83 | 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; | 85 | 85 | function fchown(fd: number, uid: number, gid: number, usePromises: typeof kUsePromises): Promise<void>; | 86 | 86 |
| 87 | 87 | function fdatasync(fd: number, req: FSReqCallback): void; | |
|