Skip to content

Commit 9010b05

Browse files
cjihrigMayaLekova
authored andcommitted
src: resolve issues reported by coverity
The specific issues raised by Coverity are: ** CID 182716: Control flow issues (DEADCODE) /src/node_file.cc: 1192 >>> CID 182716: Control flow issues (DEADCODE) >>> Execution cannot reach this statement: "args->GetReturnValue().Set(...". ** CID 182715: Uninitialized members (UNINIT_CTOR) /src/node_file.h: 29 >>> CID 182715: Uninitialized members (UNINIT_CTOR) >>> Non-static class member "syscall_" is not initialized in this constructor nor in any functions that it calls. PR-URL: nodejs#18629 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent f053da0 commit 9010b05

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/node_file.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,13 +1192,9 @@ static void OpenFileHandle(const FunctionCallbackInfo<Value>& args) {
11921192
req_wrap->SetReturnValue(args);
11931193
} else {
11941194
SYNC_CALL(open, *path, *path, flags, mode)
1195-
if (SYNC_RESULT < 0) {
1196-
args.GetReturnValue().Set(SYNC_RESULT);
1197-
} else {
1198-
HandleScope scope(env->isolate());
1199-
FileHandle* fd = new FileHandle(env, SYNC_RESULT);
1200-
args.GetReturnValue().Set(fd->object());
1201-
}
1195+
HandleScope scope(env->isolate());
1196+
FileHandle* fd = new FileHandle(env, SYNC_RESULT);
1197+
args.GetReturnValue().Set(fd->object());
12021198
}
12031199
}
12041200

src/node_file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class FSReqBase : public ReqWrap<uv_fs_t> {
6262

6363
private:
6464
enum encoding encoding_ = UTF8;
65-
const char* syscall_;
65+
const char* syscall_ = nullptr;
6666

6767
const char* data_ = nullptr;
6868
MaybeStackBuffer<char> buffer_;

0 commit comments

Comments
 (0)