From: John Wolfe Date: Mon, 7 Jun 2021 15:25:08 +0000 (-0700) Subject: Change to common source file not directly applicable to open-vm-tools. X-Git-Tag: stable-12.0.0~188 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8eedf7070b0c11c73f86e1374c004a1bc0212e1;p=thirdparty%2Fopen-vm-tools.git Change to common source file not directly applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/file/fileLockPrimitive.c b/open-vm-tools/lib/file/fileLockPrimitive.c index c6eda7390..adce64209 100644 --- a/open-vm-tools/lib/file/fileLockPrimitive.c +++ b/open-vm-tools/lib/file/fileLockPrimitive.c @@ -1282,27 +1282,22 @@ FileLockCreateEntryDirectory(const char *lockDir, // IN: if (err == 0) { /* The name exists. Deal with it... */ - if (fileData.fileType == FILE_TYPE_REGULAR) { + if (fileData.fileType != FILE_TYPE_DIRECTORY) { /* - * It's a file. Assume this is an (active?) old style lock and - * err on the safe side - don't remove it (and automatically - * upgrade to a new style lock). + * Locks are implemented via directories. Ancient hosted locks and + * lock files imported alongsize an ESXi VM are implemented as + * files. It's safe to remove these. The ESXi lock files are + * meaningless and the ancient hosted lock files have been dead + * for over a decade (at the time of writing this comment). */ - Log(LGPFX" %s: '%s' exists; an old style lock file?\n", - __FUNCTION__, lockDir); - - err = EBUSY; - break; - } - - if (fileData.fileType != FILE_TYPE_DIRECTORY) { - /* Not a directory; attempt to remove the debris */ - if (FileDeletionRobust(lockDir, FALSE) != 0) { - Warning(LGPFX" %s: '%s' exists and is not a directory.\n", + err = FileDeletionRobust(lockDir, FALSE); + if (err == 0) { + Warning(LGPFX" %s: '%s' is not a directory. Removed.\n", __FUNCTION__, lockDir); - - err = ENOTDIR; + } else { + Warning(LGPFX" %s: an attempt to remove '%s' failed: %s\n", + __FUNCTION__, lockDir, Err_Errno2String(err)); break; }