@@ -2686,18 +2686,17 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {
26862686 CHECK (args[2 ]->IsNumber ());
26872687 const double mtime = args[2 ].As <Number>()->Value ();
26882688
2689- FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2690- if ( req_wrap_async != nullptr ) { // utimes(path, atime, mtime, req)
2689+ if (argc > 3 ) { // utimes(path, atime, mtime, req)
2690+ FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
26912691 FS_ASYNC_TRACE_BEGIN1 (
26922692 UV_FS_UTIME, req_wrap_async, " path" , TRACE_STR_COPY (*path))
26932693 AsyncCall (env, req_wrap_async, args, " utime" , UTF8, AfterNoArgs,
26942694 uv_fs_utime, *path, atime, mtime);
2695- } else { // utimes(path, atime, mtime, undefined, ctx)
2696- CHECK_EQ (argc, 5 );
2697- FSReqWrapSync req_wrap_sync;
2695+ } else { // utimes(path, atime, mtime)
2696+ FSReqWrapSync req_wrap_sync (" utime" , *path);
26982697 FS_SYNC_TRACE_BEGIN (utimes);
2699- SyncCall (env, args[ 4 ], &req_wrap_sync, " utime " ,
2700- uv_fs_utime, *path, atime, mtime);
2698+ SyncCallAndThrowOnError (
2699+ env, &req_wrap_sync, uv_fs_utime, *path, atime, mtime);
27012700 FS_SYNC_TRACE_END (utimes);
27022701 }
27032702}
@@ -2717,17 +2716,16 @@ static void FUTimes(const FunctionCallbackInfo<Value>& args) {
27172716 CHECK (args[2 ]->IsNumber ());
27182717 const double mtime = args[2 ].As <Number>()->Value ();
27192718
2720- FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2721- if ( req_wrap_async != nullptr ) { // futimes(fd, atime, mtime, req)
2719+ if (argc > 3 ) { // futimes(fd, atime, mtime, req)
2720+ FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
27222721 FS_ASYNC_TRACE_BEGIN0 (UV_FS_FUTIME, req_wrap_async)
27232722 AsyncCall (env, req_wrap_async, args, " futime" , UTF8, AfterNoArgs,
27242723 uv_fs_futime, fd, atime, mtime);
2725- } else { // futimes(fd, atime, mtime, undefined, ctx)
2726- CHECK_EQ (argc, 5 );
2727- FSReqWrapSync req_wrap_sync;
2724+ } else { // futimes(fd, atime, mtime)
2725+ FSReqWrapSync req_wrap_sync (" futime" );
27282726 FS_SYNC_TRACE_BEGIN (futimes);
2729- SyncCall (env, args[ 4 ], &req_wrap_sync, " futime " ,
2730- uv_fs_futime, fd, atime, mtime);
2727+ SyncCallAndThrowOnError (
2728+ env, &req_wrap_sync, uv_fs_futime, fd, atime, mtime);
27312729 FS_SYNC_TRACE_END (futimes);
27322730 }
27332731}
@@ -2749,18 +2747,17 @@ static void LUTimes(const FunctionCallbackInfo<Value>& args) {
27492747 CHECK (args[2 ]->IsNumber ());
27502748 const double mtime = args[2 ].As <Number>()->Value ();
27512749
2752- FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2753- if ( req_wrap_async != nullptr ) { // lutimes(path, atime, mtime, req)
2750+ if (argc > 3 ) { // lutimes(path, atime, mtime, req)
2751+ FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
27542752 FS_ASYNC_TRACE_BEGIN1 (
27552753 UV_FS_LUTIME, req_wrap_async, " path" , TRACE_STR_COPY (*path))
27562754 AsyncCall (env, req_wrap_async, args, " lutime" , UTF8, AfterNoArgs,
27572755 uv_fs_lutime, *path, atime, mtime);
2758- } else { // lutimes(path, atime, mtime, undefined, ctx)
2759- CHECK_EQ (argc, 5 );
2760- FSReqWrapSync req_wrap_sync;
2756+ } else { // lutimes(path, atime, mtime)
2757+ FSReqWrapSync req_wrap_sync (" lutime" , *path);
27612758 FS_SYNC_TRACE_BEGIN (lutimes);
2762- SyncCall (env, args[ 4 ], &req_wrap_sync, " lutime " ,
2763- uv_fs_lutime, *path, atime, mtime);
2759+ SyncCallAndThrowOnError (
2760+ env, &req_wrap_sync, uv_fs_lutime, *path, atime, mtime);
27642761 FS_SYNC_TRACE_END (lutimes);
27652762 }
27662763}
0 commit comments