]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Multiple fixes for common source code.
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:43 +0000 (11:22 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:43 +0000 (11:22 -0700)
- File_FullPath() revised to return the canonical path of a file or
  directory that exists or is about to be created as a child of an
  existing directory.
- Common header file updates; not related to open-vm-tools

open-vm-tools/lib/file/filePosix.c
open-vm-tools/lib/include/dynarray.h
open-vm-tools/lib/include/mutexRankLib.h
open-vm-tools/lib/include/vm_product_versions.h

index cdfbc02df56a316a82ec9f6c84c756afab0f1c74..2b2330b0c4be360d0519faa3b88a3ca7975bfbaf 100644 (file)
@@ -566,8 +566,19 @@ File_StripFwdSlashes(const char *pathName)  // IN:
  *
  * File_FullPath --
  *
- *      Compute the full path of a file. If the file if NULL or "", the
- *      current directory is returned
+ *      This routine computes the canonical path from a supplied path.
+ *      The supplied path could be an absolute path name or a relative
+ *      one, with our without symlinks and /./ /../ separators. A
+ *      canonical representation of a path is defined as an absolute
+ *      path without symlinks and /./ /../ separators. The canonical
+ *      path of "." is the current working directory, ".." is parent
+ *      directory and so on. If the path is NULL or "", this routine
+ *      returns the current working directory.
+ *      There are mainly two use cases for this function. To find the
+ *      canonical path of a file or directory that exists, or when we
+ *      are about to create a child in an existing parent directory.
+ *      For other uses cases, this routine is not guaranteed to return
+ *      a canonical path.
  *
  * Results:
  *      NULL if error (reported to the user)
@@ -595,19 +606,33 @@ File_FullPath(const char *pathName)  // IN:
 
    if ((pathName == NULL) || Unicode_IsEmpty(pathName)) {
       ret = Unicode_Duplicate(cwd);
-   } else if (File_IsFullPath(pathName)) {
-       ret = Posix_RealPath(pathName);
-       if (ret == NULL) {
-          ret = File_StripFwdSlashes(pathName);
-       }
    } else {
-      char *path = Unicode_Join(cwd, DIRSEPS, pathName, NULL);
+      char *path;
 
-      ret = Posix_RealPath(path);
+      if (File_IsFullPath(pathName)) {
+         path = Unicode_Duplicate(pathName);
+      } else {
+         path = Unicode_Join(cwd, DIRSEPS, pathName, NULL);
+      }
 
+      ret = Posix_RealPath(path);
       if (ret == NULL) {
-         ret = File_StripFwdSlashes(path);
+         char *dir;
+         char *file;
+         char *realDir;
+
+         File_GetPathName(path, &dir, &file);
+         realDir = Posix_RealPath(dir);
+         if (realDir == NULL) {
+            realDir = File_StripFwdSlashes(dir);
+         }
+
+         ret = Unicode_Join(realDir, DIRSEPS, file, NULL);
+         free(dir);
+         free(file);
+         free(realDir);
       }
+
       free(path);
    }
 
index d6c6b0355f59a4f00f3b75486641cdf32d298b41..e766682d9a9827c6c47a314e003f8cd962549c8c 100644 (file)
@@ -285,10 +285,16 @@ DynArray_Copy(DynArray *src,        // IN
       return (TYPE*)DynArray_AddressOf((DynArray *)a, i);               \
    }                                                                    \
                                                                         \
+   static INLINE TYPE*                                                  \
+   T##Array_AddressOfUnsafe(T##Array *a, unsigned int i)                \
+   {                                                                    \
+      return (TYPE*)DynArray_AddressOfUnsafe((DynArray *)a, i);         \
+   }                                                                    \
+                                                                        \
    static INLINE unsigned int                                           \
-   T##Array_Count(T##Array *a)                                          \
+   T##Array_Count(const T##Array *a)                                    \
    {                                                                    \
-      return DynArray_Count((DynArray *)a);                             \
+      return DynArray_Count((const DynArray *)a);                       \
    }                                                                    \
                                                                         \
    static INLINE Bool                                                   \
index 4340b156f6c4dfdd577c74b23fe43fccca2fb9b2..3726c1ffd770a9432c0443063a0fd284561fc8b7 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2010-2015 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2016 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
 /*
  * NFC lib lock
  */
-#define RANK_nfcLibLock              (RANK_libLockBase + 0x4505)
+#define RANK_nfcLibInitLock          (RANK_libLockBase + 0x4505)
+#define RANK_nfcLibLock              (RANK_libLockBase + 0x4506)
 
 /*
  * Policy lib lock
index cd45dca0f4e0895c712781be177476ec6149b1c0..aeadc8ba5482a84439d83280418588c68a7a473c 100644 (file)
 #define PRODUCT_ESX_LICENSE_VERSION "6.0"
 #define PRODUCT_ESX_LICENSE_FILE_VERSION "6.1.0.5"
 #define PRODUCT_VSAN_LICENSE_VERSION "5.0"
-#define PRODUCT_VSAN_LICENSE_FILE_VERSION "5.9.2.0"
+#define PRODUCT_VSAN_LICENSE_FILE_VERSION "5.9.2.1"
 
 /*
  * This is for ACE Management Server