From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:51 +0000 (-0700) Subject: lib/file/filePosix.c: Implement File_GetMountPath() for POSIX X-Git-Tag: stable-10.2.0~95 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=04d01f93f26b748d0fbb6bc1ea571e90fbc005d7;p=thirdparty%2Fopen-vm-tools.git lib/file/filePosix.c: Implement File_GetMountPath() for POSIX - The change implements File_GetMountPath() for POSIX, using realpath(3) and readlink(2). Changes to common header files; not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/asyncsocket/asyncSocketVTable.h b/open-vm-tools/lib/asyncsocket/asyncSocketVTable.h index afb5e544b..54ad31b2a 100644 --- a/open-vm-tools/lib/asyncsocket/asyncSocketVTable.h +++ b/open-vm-tools/lib/asyncsocket/asyncSocketVTable.h @@ -67,7 +67,10 @@ typedef struct AsyncSocketVTable { socklen_t inBufLen); /* * A setOption() implementation must have a symmetrical getOption() - * counterpart. + * counterpart. The converse is not true -- a getOption() + * implementation need not have a setOption() counterpart. (One + * way to look at this is that an option may be read-only, but it + * must not be write-only.) */ int (*getOption)(AsyncSocket *asyncSocket, AsyncSocketOpts_Layer layer, diff --git a/open-vm-tools/lib/file/filePosix.c b/open-vm-tools/lib/file/filePosix.c index 6f3d7b2fb..6f45d8465 100644 --- a/open-vm-tools/lib/file/filePosix.c +++ b/open-vm-tools/lib/file/filePosix.c @@ -3288,6 +3288,24 @@ char * File_GetMountPath(const char *pathName, // IN: Bool checkEntirePath) // IN: { - NOT_IMPLEMENTED(); + char *mountPath; + + if (pathName == NULL) { + return NULL; + } + + if (checkEntirePath) { + return Posix_RealPath(pathName); + } + + mountPath = Posix_ReadLink(pathName); + if (mountPath != NULL) { + return mountPath; + } + + if (!Posix_Access(pathName, F_OK)) { + return Util_SafeStrdup(pathName); + } + return NULL; } diff --git a/open-vm-tools/lib/include/asyncsocket.h b/open-vm-tools/lib/include/asyncsocket.h index b1ab8624f..f5cf148eb 100644 --- a/open-vm-tools/lib/include/asyncsocket.h +++ b/open-vm-tools/lib/include/asyncsocket.h @@ -313,6 +313,9 @@ typedef enum { * ASYNC_SOCKET_OPTS_LAYER_, * ASYNC_SOCKET_OPTS_LAYER_, ... */ + + ASYNC_SOCKET_OPTS_LAYER_BLAST_PROXY, + } AsyncSocketOpts_Layer; /*