mirror of https://github.com/nodejs/node.git
fs: throw fchownSync error from c++
PR-URL: https://github.com/nodejs/node/pull/51075 Refs: https://github.com/nodejs/performance/issues/106 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: James M Snell <jasnell@gmail.com>pull/49579/head
parent
9e87091311
commit
3551dc07eb
|
@ -2051,9 +2051,7 @@ function fchownSync(fd, uid, gid) {
|
|||
validateInteger(uid, 'uid', -1, kMaxUserId);
|
||||
validateInteger(gid, 'gid', -1, kMaxUserId);
|
||||
|
||||
const ctx = {};
|
||||
binding.fchown(fd, uid, gid, undefined, ctx);
|
||||
handleErrorFromBinding(ctx);
|
||||
binding.fchown(fd, uid, gid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2590,17 +2590,15 @@ static void FChown(const FunctionCallbackInfo<Value>& args) {
|
|||
CHECK(IsSafeJsInt(args[2]));
|
||||
const uv_gid_t gid = static_cast<uv_gid_t>(args[2].As<Integer>()->Value());
|
||||
|
||||
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
|
||||
if (req_wrap_async != nullptr) { // fchown(fd, uid, gid, req)
|
||||
if (argc > 3) { // fchown(fd, uid, gid, req)
|
||||
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
|
||||
FS_ASYNC_TRACE_BEGIN0(UV_FS_FCHOWN, req_wrap_async)
|
||||
AsyncCall(env, req_wrap_async, args, "fchown", UTF8, AfterNoArgs,
|
||||
uv_fs_fchown, fd, uid, gid);
|
||||
} else { // fchown(fd, uid, gid, undefined, ctx)
|
||||
CHECK_EQ(argc, 5);
|
||||
FSReqWrapSync req_wrap_sync;
|
||||
} else { // fchown(fd, uid, gid)
|
||||
FSReqWrapSync req_wrap_sync("fchown");
|
||||
FS_SYNC_TRACE_BEGIN(fchown);
|
||||
SyncCall(env, args[4], &req_wrap_sync, "fchown",
|
||||
uv_fs_fchown, fd, uid, gid);
|
||||
SyncCallAndThrowOnError(env, &req_wrap_sync, uv_fs_fchown, fd, uid, gid);
|
||||
FS_SYNC_TRACE_END(fchown);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ declare namespace InternalFSBinding {
|
|||
function fchmod(fd: number, mode: number, usePromises: typeof kUsePromises): Promise<void>;
|
||||
|
||||
function fchown(fd: number, uid: number, gid: number, req: FSReqCallback): void;
|
||||
function fchown(fd: number, uid: number, gid: number, req: undefined, ctx: FSSyncContext): void;
|
||||
function fchown(fd: number, uid: number, gid: number): void;
|
||||
function fchown(fd: number, uid: number, gid: number, usePromises: typeof kUsePromises): Promise<void>;
|
||||
|
||||
function fdatasync(fd: number, req: FSReqCallback): void;
|
||||
|
|
Loading…
Reference in New Issue