File tree 3 files changed +3
-21
lines changed
3 files changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -1330,6 +1330,7 @@ function fsync(fd, callback) {
1330
1330
* @returns {void }
1331
1331
*/
1332
1332
function fsyncSync ( fd ) {
1333
+ fd = getValidatedFd ( fd ) ;
1333
1334
return binding . fsync ( fd ) ;
1334
1335
}
1335
1336
Original file line number Diff line number Diff line change @@ -116,24 +116,6 @@ inline int64_t GetOffset(Local<Value> value) {
116
116
return IsSafeJsInt (value) ? value.As <Integer>()->Value () : -1 ;
117
117
}
118
118
119
- inline int GetValidatedFd (Environment* env, Local<Value> value) {
120
- if (!value->IsInt32 ()) {
121
- env->isolate ()->ThrowException (ERR_INVALID_ARG_TYPE (
122
- env->isolate (), " Invalid argument. The fd must be int32." ));
123
- return 1 << 30 ;
124
- }
125
-
126
- const int fd = value.As <Int32>()->Value ();
127
-
128
- if (fd < 0 || fd > INT32_MAX) {
129
- env->isolate ()->ThrowException (ERR_OUT_OF_RANGE (
130
- env->isolate (), " It must be >= 0 && <= INT32_MAX. Received %d" , fd));
131
- return 1 << 30 ;
132
- }
133
-
134
- return fd;
135
- }
136
-
137
119
static const char * get_fs_func_name_by_type (uv_fs_type req_type) {
138
120
switch (req_type) {
139
121
#define FS_TYPE_TO_NAME (type, name ) \
@@ -1544,8 +1526,8 @@ static void Fsync(const FunctionCallbackInfo<Value>& args) {
1544
1526
const int argc = args.Length ();
1545
1527
CHECK_GE (argc, 1 );
1546
1528
1547
- const int fd = GetValidatedFd (env, args[0 ]);
1548
- if ( fd == ( 1 << 30 )) return ;
1529
+ CHECK ( args[0 ]-> IsInt32 () );
1530
+ const int fd = args[ 0 ]. As <Int32>()-> Value () ;
1549
1531
1550
1532
if (argc > 1 ) {
1551
1533
FSReqBase* req_wrap_async = GetReqWrap (args, 1 );
Original file line number Diff line number Diff line change @@ -244,7 +244,6 @@ export interface FsBinding {
244
244
fdatasync : typeof InternalFSBinding . fdatasync ;
245
245
fstat : typeof InternalFSBinding . fstat ;
246
246
fsync : typeof InternalFSBinding . fsync ;
247
- fsyncSync : typeof InternalFSBinding . fsyncSync ;
248
247
ftruncate : typeof InternalFSBinding . ftruncate ;
249
248
futimes : typeof InternalFSBinding . futimes ;
250
249
internalModuleReadJSON : typeof InternalFSBinding . internalModuleReadJSON ;
You can’t perform that action at this time.
0 commit comments