From e94fc95c580ce75ccc34793ffb000d9765ebe3d3 Mon Sep 17 00:00:00 2001
From: Cathy Avery <cavery@redhat.com>
Date: Thu, 25 Jul 2019 12:32:36 +0200
Subject: [PATCH 13/16] Fix 'Using uninitialized value' issue reported by
Coverity.
RH-Author: Cathy Avery <cavery@redhat.com>
Message-id: <20190725123239.18274-14-cavery@redhat.com>
Patchwork-id: 89714
O-Subject: [RHEL8.1 open-vm-tools PATCH 13/16] Fix 'Using uninitialized value' issue reported by Coverity.
Bugzilla: 1602648
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
commit f456a5938662175b914ffcb53c6284835476268f
Author: Oliver Kurth <okurth@vmware.com>
Date: Mon Jun 17 11:41:37 2019 -0700
Fix 'Using uninitialized value' issue reported by Coverity.
* 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.
Signed-off-by: Cathy Avery <cavery@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
open-vm-tools/lib/procMgr/procMgrPosix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/procMgr/procMgrPosix.c b/lib/procMgr/procMgrPosix.c
index 3ff98eb..fe26d42 100644
--- a/lib/procMgr/procMgrPosix.c
+++ b/lib/procMgr/procMgrPosix.c
@@ -1582,8 +1582,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;
@@ -1608,6 +1606,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
--
1.8.3.1