]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/file: Add missing errno for FileLock_Lock()
authorOliver Kurth <okurth@vmware.com>
Mon, 20 Aug 2018 19:48:09 +0000 (12:48 -0700)
committerOliver Kurth <okurth@vmware.com>
Mon, 20 Aug 2018 19:48:09 +0000 (12:48 -0700)
FileLock_Lock() can return the errno to the caller through int *err.
Before this change, one case is missing: EAGAIN.  This change will fix it.

open-vm-tools/lib/file/fileLockPosix.c

index 922eb18c60769a2881f6790f9312eedf9b514117..e76df2abb87a9c00e7e7d4e97f7ee05b8d9f91e0 100644 (file)
@@ -1151,21 +1151,17 @@ FileLock_Lock(const char *filePath,          // IN:
       Posix_Free(normalizedPath);
    }
 
-   if (err != NULL) {
-      *err = res;
-   }
-
    if (tokenPtr == NULL) {
-      int errnoValue;
-
       if (res == 0) {
-         errnoValue = EAGAIN;  // Thank you for playing; try again
+         res = EAGAIN;  // Thank you for playing; try again
          /* Failed to acquire the lock; another has possession of it */
-      } else {
-         errnoValue = res;
       }
 
-      FileLockAppendMessage(msgs, errnoValue);
+      FileLockAppendMessage(msgs, res);
+   }
+
+   if (err != NULL) {
+      *err = res;
    }
 
    return tokenPtr;