]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix Coverity-reported dead code issue.
authorOliver Kurth <okurth@vmware.com>
Fri, 12 Jun 2020 03:43:21 +0000 (20:43 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 12 Jun 2020 03:43:21 +0000 (20:43 -0700)
The underlying problem was that retryCount was being zeroed on every
iteration of the while loop.  Zero it before entering the loop instead.

open-vm-tools/lib/rpcChannel/simpleSocket.c

index e38e14d725791183f2612172ce57257ae35a2f48..1d085436a14d0f7f1cb9c6c9c91d8bbbd942dcd6 100644 (file)
@@ -346,6 +346,7 @@ Socket_ConnectVMCI(unsigned int cid,                  // IN
    ApiError apiErr;
    int vsockDev = -1;
    int family = VMCISock_GetAFValueFd(&vsockDev);
+   int retryCount = 0;
 
    if (family == -1) {
       Warning(LGPFX "Couldn't get VMCI socket family info.");
@@ -376,8 +377,6 @@ Socket_ConnectVMCI(unsigned int cid,                  // IN
    /* We are required to use a privileged source port. */
    localPort = PRIVILEGED_PORT_MAX;
    while (localPort >= PRIVILEGED_PORT_MIN) {
-      int retryCount = 0;
-
       fd = SocketConnectVmciInternal(&addr, localPort, &apiErr, &sysErr);
       if (fd != INVALID_SOCKET) {
          goto done;