]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/file: IsLocked err argument is optional
authorVMware, Inc <>
Thu, 22 Dec 2011 00:36:53 +0000 (16:36 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 22 Dec 2011 00:36:53 +0000 (16:36 -0800)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/file/fileLockPrimitive.c

index bf98721c6d2483b25ea1537a18251fb6612cd408..9df2b3cc21b9a5b06a6633cf1f277ea66dec98b2 100644 (file)
@@ -1886,7 +1886,7 @@ FileLockIntrinsic(ConstUnicode pathName,   // IN:
 
 static Bool
 FileLockIsLockedMandatory(ConstUnicode lockFile,  // IN:
-                          int *err)               // OUT:
+                          int *err)               // OUT/OPT:
 {
    int access;
    FileIOResult result;
@@ -1914,7 +1914,9 @@ FileLockIsLockedMandatory(ConstUnicode lockFile,  // IN:
    } else if (result == FILEIO_FILE_NOT_FOUND) {
       return FALSE;  // no lock file means unlocked
    } else {
-      *err = FileMapErrorToErrno(__FUNCTION__, Err_Errno());
+      if (err != NULL) {
+         *err = FileMapErrorToErrno(__FUNCTION__, Err_Errno());
+      }
 
       return FALSE;
    }
@@ -1946,7 +1948,7 @@ FileLockIsLockedMandatory(ConstUnicode lockFile,  // IN:
 
 static Bool
 FileLockIsLockedPortable(ConstUnicode lockDir,  // IN:
-                         int *err)              // OUT:
+                         int *err)              // OUT/OPT:
 {
    uint32 i;
    int numEntries;
@@ -1960,9 +1962,11 @@ FileLockIsLockedPortable(ConstUnicode lockDir,  // IN:
        * If the lock directory doesn't exist, we should not count this
        * as an error.  This is expected if the file isn't locked.
        */
+
       if (err != NULL) {
          *err = errno;
       }
+
       return FALSE;
    }
 
@@ -2001,7 +2005,7 @@ FileLockIsLockedPortable(ConstUnicode lockDir,  // IN:
 
 Bool
 FileLockIsLocked(ConstUnicode pathName,  // IN:
-                 int *err)               // OUT:
+                 int *err)               // OUT/OPT:
 {
    Unicode lockBase = Unicode_Append(pathName, FILELOCK_SUFFIX);
    Bool isLocked;