From: Oliver Kurth Date: Fri, 15 Sep 2017 18:22:43 +0000 (-0700) Subject: Multiple fixes for common source code. X-Git-Tag: stable-10.2.0~711 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=125541c04a7aeac6e152fb5a622ba9052bfca294;p=thirdparty%2Fopen-vm-tools.git Multiple fixes for common source code. - 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 --- diff --git a/open-vm-tools/lib/file/filePosix.c b/open-vm-tools/lib/file/filePosix.c index cdfbc02df..2b2330b0c 100644 --- a/open-vm-tools/lib/file/filePosix.c +++ b/open-vm-tools/lib/file/filePosix.c @@ -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); } diff --git a/open-vm-tools/lib/include/dynarray.h b/open-vm-tools/lib/include/dynarray.h index d6c6b0355..e766682d9 100644 --- a/open-vm-tools/lib/include/dynarray.h +++ b/open-vm-tools/lib/include/dynarray.h @@ -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 \ diff --git a/open-vm-tools/lib/include/mutexRankLib.h b/open-vm-tools/lib/include/mutexRankLib.h index 4340b156f..3726c1ffd 100644 --- a/open-vm-tools/lib/include/mutexRankLib.h +++ b/open-vm-tools/lib/include/mutexRankLib.h @@ -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 @@ -109,7 +109,8 @@ /* * NFC lib lock */ -#define RANK_nfcLibLock (RANK_libLockBase + 0x4505) +#define RANK_nfcLibInitLock (RANK_libLockBase + 0x4505) +#define RANK_nfcLibLock (RANK_libLockBase + 0x4506) /* * Policy lib lock diff --git a/open-vm-tools/lib/include/vm_product_versions.h b/open-vm-tools/lib/include/vm_product_versions.h index cd45dca0f..aeadc8ba5 100644 --- a/open-vm-tools/lib/include/vm_product_versions.h +++ b/open-vm-tools/lib/include/vm_product_versions.h @@ -399,7 +399,7 @@ #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