|
|
3857c4 |
From 8fbef69f0b3ce6648d594794b945169331ddfa06 Mon Sep 17 00:00:00 2001
|
|
|
d75d53 |
From: Cathy Avery <cavery@redhat.com>
|
|
|
d75d53 |
Date: Tue, 3 Dec 2019 14:30:49 +0100
|
|
|
3857c4 |
Subject: Address two Coverity-reported issues in hostinfoPosix.c.
|
|
|
d75d53 |
|
|
|
d75d53 |
RH-Author: Cathy Avery <cavery@redhat.com>
|
|
|
d75d53 |
Message-id: <20191203143050.23065-4-cavery@redhat.com>
|
|
|
d75d53 |
Patchwork-id: 92834
|
|
|
d75d53 |
O-Subject: [RHEL8.2 open-vm-tools PATCH 3/4] Address two Coverity-reported issues in hostinfoPosix.c.
|
|
|
d75d53 |
Bugzilla: 1769881
|
|
|
d75d53 |
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
d75d53 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
d75d53 |
|
|
|
d75d53 |
commit 8a01c912927b5bb8cdbfa57f5e8c92e8cf792bef
|
|
|
d75d53 |
Author: Oliver Kurth <okurth@vmware.com>
|
|
|
d75d53 |
Date: Fri Nov 22 14:52:35 2019 -0800
|
|
|
d75d53 |
|
|
|
d75d53 |
Address two Coverity-reported issues in hostinfoPosix.c.
|
|
|
d75d53 |
|
|
|
d75d53 |
Rework some code with the intent of making it more straightfoward,
|
|
|
d75d53 |
which also eliminates a false positive.
|
|
|
d75d53 |
|
|
|
d75d53 |
Check the return value from PosixUnlink and log a warning on error.
|
|
|
d75d53 |
|
|
|
d75d53 |
Signed-off-by: Cathy Avery <cavery@redhat.com>
|
|
|
d75d53 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
d75d53 |
---
|
|
|
d75d53 |
open-vm-tools/lib/misc/hostinfoPosix.c | 10 +++++-----
|
|
|
d75d53 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
d75d53 |
|
|
|
d75d53 |
diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c
|
|
|
3857c4 |
index 9d58abe..20cefb5 100644
|
|
|
d75d53 |
--- a/open-vm-tools/lib/misc/hostinfoPosix.c
|
|
|
d75d53 |
+++ b/open-vm-tools/lib/misc/hostinfoPosix.c
|
|
|
3857c4 |
@@ -1153,10 +1153,7 @@ out:
|
|
|
d75d53 |
if (success) {
|
|
|
d75d53 |
result[nArgs - 1] = DynBuf_Detach(&b);
|
|
|
d75d53 |
} else {
|
|
|
d75d53 |
- if (nArgs != 0) {
|
|
|
d75d53 |
- Util_FreeStringList(result, nArgs);
|
|
|
d75d53 |
- }
|
|
|
d75d53 |
-
|
|
|
d75d53 |
+ Util_FreeStringList(result, nArgs);
|
|
|
d75d53 |
result = NULL;
|
|
|
d75d53 |
}
|
|
|
d75d53 |
|
|
|
3857c4 |
@@ -2916,7 +2913,10 @@ Hostinfo_Daemonize(const char *path, // IN: NUL-terminated UTF-8
|
|
|
d75d53 |
* with another process attempting to daemonize and unlinking the
|
|
|
d75d53 |
* file it created instead.
|
|
|
d75d53 |
*/
|
|
|
d75d53 |
- Posix_Unlink(pidPath);
|
|
|
d75d53 |
+ if (Posix_Unlink(pidPath) != 0) {
|
|
|
d75d53 |
+ Warning("%s: Unable to unlink %s: %u\n",
|
|
|
d75d53 |
+ __FUNCTION__, pidPath, errno);
|
|
|
d75d53 |
+ }
|
|
|
d75d53 |
}
|
|
|
d75d53 |
|
|
|
d75d53 |
errno = err;
|
|
|
d75d53 |
--
|
|
|
d75d53 |
1.8.3.1
|
|
|
d75d53 |
|