]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix 'Using uninitialized value' issue reported by Coverity.
authorOliver Kurth <okurth@vmware.com>
Mon, 17 Jun 2019 18:41:37 +0000 (11:41 -0700)
committerOliver Kurth <okurth@vmware.com>
Mon, 17 Jun 2019 18:41:37 +0000 (11:41 -0700)
* In a error code path, 'exitCode' variable is used without
  any initialization.  This issue was reported by the Coverity.
  Fixed it by initializing the 'exitCode' to -1.

* While fixing this, moved the variables to the if block where
  they are acutally used.

open-vm-tools/lib/procMgr/procMgrPosix.c

index e2cd0619f0e22db2d1df7683c48221581da4a1d4..2f7711bdbdc02bc50882eb59a315fc2a24a28623 100644 (file)
@@ -1638,8 +1638,6 @@ ProcMgr_ExecAsync(char const *cmd,                 // IN: UTF-8 command line
    ProcMgr_AsyncProc *asyncProc = NULL;
    pid_t pid;
    int fds[2];
-   Bool validExitCode = FALSE;
-   int exitCode;
    pid_t resultPid;
    int readFd, writeFd;
 
@@ -1664,6 +1662,8 @@ ProcMgr_ExecAsync(char const *cmd,                 // IN: UTF-8 command line
       int i, maxfd;
       Bool status = TRUE;
       pid_t childPid = -1;
+      Bool validExitCode = FALSE;
+      int exitCode = -1;
 
       /*
        * Child