@@ -2721,18 +2721,17 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {
27212721 CHECK (args[2 ]->IsNumber ());
27222722 const double mtime = args[2 ].As <Number>()->Value ();
27232723
2724- FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2725- if ( req_wrap_async != nullptr ) { // utimes(path, atime, mtime, req)
2724+ if (argc > 3 ) { // utimes(path, atime, mtime, req)
2725+ FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
27262726 FS_ASYNC_TRACE_BEGIN1 (
27272727 UV_FS_UTIME, req_wrap_async, " path" , TRACE_STR_COPY (*path))
27282728 AsyncCall (env, req_wrap_async, args, " utime" , UTF8, AfterNoArgs,
27292729 uv_fs_utime, *path, atime, mtime);
2730- } else { // utimes(path, atime, mtime, undefined, ctx)
2731- CHECK_EQ (argc, 5 );
2732- FSReqWrapSync req_wrap_sync;
2730+ } else { // utimes(path, atime, mtime)
2731+ FSReqWrapSync req_wrap_sync (" utime" , *path);
27332732 FS_SYNC_TRACE_BEGIN (utimes);
2734- SyncCall (env, args[ 4 ], &req_wrap_sync, " utime " ,
2735- uv_fs_utime, *path, atime, mtime);
2733+ SyncCallAndThrowOnError (
2734+ env, &req_wrap_sync, uv_fs_utime, *path, atime, mtime);
27362735 FS_SYNC_TRACE_END (utimes);
27372736 }
27382737}
@@ -2752,17 +2751,16 @@ static void FUTimes(const FunctionCallbackInfo<Value>& args) {
27522751 CHECK (args[2 ]->IsNumber ());
27532752 const double mtime = args[2 ].As <Number>()->Value ();
27542753
2755- FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2756- if ( req_wrap_async != nullptr ) { // futimes(fd, atime, mtime, req)
2754+ if (argc > 3 ) { // futimes(fd, atime, mtime, req)
2755+ FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
27572756 FS_ASYNC_TRACE_BEGIN0 (UV_FS_FUTIME, req_wrap_async)
27582757 AsyncCall (env, req_wrap_async, args, " futime" , UTF8, AfterNoArgs,
27592758 uv_fs_futime, fd, atime, mtime);
2760- } else { // futimes(fd, atime, mtime, undefined, ctx)
2761- CHECK_EQ (argc, 5 );
2762- FSReqWrapSync req_wrap_sync;
2759+ } else { // futimes(fd, atime, mtime)
2760+ FSReqWrapSync req_wrap_sync (" futime" );
27632761 FS_SYNC_TRACE_BEGIN (futimes);
2764- SyncCall (env, args[ 4 ], &req_wrap_sync, " futime " ,
2765- uv_fs_futime, fd, atime, mtime);
2762+ SyncCallAndThrowOnError (
2763+ env, &req_wrap_sync, uv_fs_futime, fd, atime, mtime);
27662764 FS_SYNC_TRACE_END (futimes);
27672765 }
27682766}
@@ -2784,18 +2782,17 @@ static void LUTimes(const FunctionCallbackInfo<Value>& args) {
27842782 CHECK (args[2 ]->IsNumber ());
27852783 const double mtime = args[2 ].As <Number>()->Value ();
27862784
2787- FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2788- if ( req_wrap_async != nullptr ) { // lutimes(path, atime, mtime, req)
2785+ if (argc > 3 ) { // lutimes(path, atime, mtime, req)
2786+ FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
27892787 FS_ASYNC_TRACE_BEGIN1 (
27902788 UV_FS_LUTIME, req_wrap_async, " path" , TRACE_STR_COPY (*path))
27912789 AsyncCall (env, req_wrap_async, args, " lutime" , UTF8, AfterNoArgs,
27922790 uv_fs_lutime, *path, atime, mtime);
2793- } else { // lutimes(path, atime, mtime, undefined, ctx)
2794- CHECK_EQ (argc, 5 );
2795- FSReqWrapSync req_wrap_sync;
2791+ } else { // lutimes(path, atime, mtime)
2792+ FSReqWrapSync req_wrap_sync (" lutime" , *path);
27962793 FS_SYNC_TRACE_BEGIN (lutimes);
2797- SyncCall (env, args[ 4 ], &req_wrap_sync, " lutime " ,
2798- uv_fs_lutime, *path, atime, mtime);
2794+ SyncCallAndThrowOnError (
2795+ env, &req_wrap_sync, uv_fs_lutime, *path, atime, mtime);
27992796 FS_SYNC_TRACE_END (lutimes);
28002797 }
28012798}
0 commit comments