From 7a09219ca17ce397fa7ee29935421c0482e78278 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 7 Feb 2018 14:51:10 -0500 Subject: [PATCH] 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. --- src/node_file.cc | 10 +++------- src/node_file.h | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/node_file.cc b/src/node_file.cc index 8f016ccf02695b..5bde996842b778 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -1188,13 +1188,9 @@ static void OpenFileHandle(const FunctionCallbackInfo& args) { req_wrap->SetReturnValue(args); } else { SYNC_CALL(open, *path, *path, flags, mode) - if (SYNC_RESULT < 0) { - args.GetReturnValue().Set(SYNC_RESULT); - } else { - HandleScope scope(env->isolate()); - FileHandle* fd = new FileHandle(env, SYNC_RESULT); - args.GetReturnValue().Set(fd->object()); - } + HandleScope scope(env->isolate()); + FileHandle* fd = new FileHandle(env, SYNC_RESULT); + args.GetReturnValue().Set(fd->object()); } } diff --git a/src/node_file.h b/src/node_file.h index d49807f5294e01..b76caa1467b3e2 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -62,7 +62,7 @@ class FSReqBase : public ReqWrap { private: enum encoding encoding_ = UTF8; - const char* syscall_; + const char* syscall_ = nullptr; const char* data_ = nullptr; MaybeStackBuffer buffer_;