]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
[Tools/dndcp] Fix two coverity issues reported by a customer.
authorOliver Kurth <okurth@vmware.com>
Sun, 21 Jul 2019 00:03:42 +0000 (17:03 -0700)
committerOliver Kurth <okurth@vmware.com>
Sun, 21 Jul 2019 00:03:42 +0000 (17:03 -0700)
open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp

index 91bae624f72de8f02fb0586fc1040b93c5b176df..fad000e3a85115697ce94dab5721d000eba62c15 100644 (file)
@@ -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(&params->fileBlockMutex);
    return NULL;