From: Oliver Kurth Date: Sun, 21 Jul 2019 00:03:42 +0000 (-0700) Subject: [Tools/dndcp] Fix two coverity issues reported by a customer. X-Git-Tag: stable-11.0.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f65edaec32d2e1c7c14d69f4f2af669805cfd4b4;p=thirdparty%2Fopen-vm-tools.git [Tools/dndcp] Fix two coverity issues reported by a customer. --- diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp index 91bae624f..fad000e3a 100644 --- a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp @@ -1676,10 +1676,11 @@ CopyPasteUIX11::FileBlockMonitorThread(void *arg) // IN } int fd = open(params->fileBlockName.c_str(), O_RDONLY); - if (fd <= 0) { - g_debug("%s: Failed to open %s\n", + if (fd < 0) { + g_debug("%s: Failed to open %s, errno is %d\n", __FUNCTION__, - params->fileBlockName.c_str()); + params->fileBlockName.c_str(), + errno); continue; } @@ -1700,6 +1701,13 @@ CopyPasteUIX11::FileBlockMonitorThread(void *arg) // IN } else { g_debug("%s: Block is not added\n", __FUNCTION__); } + + if (close(fd) < 0) { + g_debug("%s: Failed to close %s, errno is %d\n", + __FUNCTION__, + params->fileBlockName.c_str(), + errno); + } } pthread_mutex_unlock(¶ms->fileBlockMutex); return NULL;