File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -518,7 +518,7 @@ function close(fd, callback = defaultCloseCallback) {
518518
519519 const req = new FSReqCallback ( ) ;
520520 req . oncomplete = callback ;
521- binding . close ( getValidatedFd ( fd ) , req ) ;
521+ binding . close ( fd , req ) ;
522522}
523523
524524/**
@@ -527,7 +527,7 @@ function close(fd, callback = defaultCloseCallback) {
527527 * @returns {void }
528528 */
529529function closeSync ( fd ) {
530- binding . close ( getValidatedFd ( fd ) ) ;
530+ binding . close ( fd ) ;
531531}
532532
533533/**
Original file line number Diff line number Diff line change @@ -984,8 +984,10 @@ void Close(const FunctionCallbackInfo<Value>& args) {
984984 const int argc = args.Length ();
985985 CHECK_GE (argc, 1 );
986986
987- CHECK (args[0 ]->IsInt32 ());
988- int fd = args[0 ].As <Int32>()->Value ();
987+ int fd;
988+ if (!GetValidatedFd (env, args[0 ]).To (&fd)) {
989+ return ;
990+ }
989991 env->RemoveUnmanagedFd (fd);
990992
991993 if (argc > 1 ) { // close(fd, req)
You can’t perform that action at this time.
0 commit comments