From: Oliver Kurth Date: Mon, 20 Aug 2018 19:48:09 +0000 (-0700) Subject: lib/file: Add missing errno for FileLock_Lock() X-Git-Tag: stable-11.0.0~453 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d33923a603758f1d97bad4245674a403f1d5944;p=thirdparty%2Fopen-vm-tools.git lib/file: Add missing errno for FileLock_Lock() 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. --- diff --git a/open-vm-tools/lib/file/fileLockPosix.c b/open-vm-tools/lib/file/fileLockPosix.c index 922eb18c6..e76df2abb 100644 --- a/open-vm-tools/lib/file/fileLockPosix.c +++ b/open-vm-tools/lib/file/fileLockPosix.c @@ -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;