GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fs: improve error performance of `lchownSync` · nodejs/node@4242cb7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • fs.js
  • src
    • node_file.cc
  • typings/internalBinding
    • fs.d.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/fs.js‎

Copy file name to clipboardExpand all lines: lib/fs.js
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,9 +2010,11 @@ function lchownSync(path, uid, gid) {
20102010
path = getValidatedPath(path);
20112011
validateInteger(uid, 'uid', -1, kMaxUserId);
20122012
validateInteger(gid, 'gid', -1, kMaxUserId);
2013-
const ctx = { path };
2014-
binding.lchown(pathModule.toNamespacedPath(path), uid, gid, undefined, ctx);
2015-
handleErrorFromBinding(ctx);
2013+
binding.lchown(
2014+
pathModule.toNamespacedPath(path),
2015+
uid,
2016+
gid,
2017+
);
20162018
}
20172019

20182020
/**
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
@@ -2668,18 +2668,16 @@ static void LChown(const FunctionCallbackInfo<Value>& args) {
26682668
CHECK(IsSafeJsInt(args[2]));
26692669
const uv_gid_t gid = static_cast<uv_gid_t>(args[2].As<Integer>()->Value());
26702670

2671-
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
2672-
if (req_wrap_async != nullptr) { // lchown(path, uid, gid, req)
2671+
if (argc > 3) { // lchown(path, uid, gid, req)
2672+
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
26732673
FS_ASYNC_TRACE_BEGIN1(
26742674
UV_FS_LCHOWN, req_wrap_async, "path", TRACE_STR_COPY(*path))
26752675
AsyncCall(env, req_wrap_async, args, "lchown", UTF8, AfterNoArgs,
26762676
uv_fs_lchown, *path, uid, gid);
2677-
} else { // lchown(path, uid, gid, undefined, ctx)
2678-
CHECK_EQ(argc, 5);
2679-
FSReqWrapSync req_wrap_sync;
2677+
} else { // lchown(path, uid, gid)
2678+
FSReqWrapSync req_wrap_sync("lchown", *path);
26802679
FS_SYNC_TRACE_BEGIN(lchown);
2681-
SyncCall(env, args[4], &req_wrap_sync, "lchown",
2682-
uv_fs_lchown, *path, uid, gid);
2680+
SyncCallAndThrowOnError(env, &req_wrap_sync, uv_fs_lchown, *path, uid, gid);
26832681
FS_SYNC_TRACE_END(lchown);
26842682
}
26852683
}
Collapse file

‎typings/internalBinding/fs.d.ts‎

Copy file name to clipboardExpand all lines: typings/internalBinding/fs.d.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ declare namespace InternalFSBinding {
117117
function lchown(path: string, uid: number, gid: number, req: FSReqCallback): void;
118118
function lchown(path: string, uid: number, gid: number, req: undefined, ctx: FSSyncContext): void;
119119
function lchown(path: string, uid: number, gid: number, usePromises: typeof kUsePromises): Promise<void>;
120+
function lchown(path: string, uid: number, gid: number): void;
120121

121122
function link(existingPath: string, newPath: string, req: FSReqCallback): void;
122123
function link(existingPath: string, newPath: string, req: undefined, ctx: FSSyncContext): void;

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.