From: Oliver Kurth Date: Tue, 19 Jun 2018 18:07:45 +0000 (-0700) Subject: Use "/var/run" or "/run" instead of "/tmp" in Linux guest for imc package copy X-Git-Tag: stable-10.3.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=104cab14e08b93a2525992e09f0d13ff26d52d9d;p=thirdparty%2Fopen-vm-tools.git Use "/var/run" or "/run" instead of "/tmp" in Linux guest for imc package copy 1. check if /var/run is a directory in VM 2. if Yes, use /var/run/XXXXXX 3. check if /run is a directory in VM 4. if Yes, use /run/XXXXXX 5. if both No, use /tmp/XXXXXX as before --- diff --git a/open-vm-tools/services/plugins/deployPkg/deployPkg.c b/open-vm-tools/services/plugins/deployPkg/deployPkg.c index 7c6a8affe..63754486a 100644 --- a/open-vm-tools/services/plugins/deployPkg/deployPkg.c +++ b/open-vm-tools/services/plugins/deployPkg/deployPkg.c @@ -325,12 +325,34 @@ DeployPkgGetTempDir(void) char *dir = NULL; char *newDir = NULL; Bool found = FALSE; +#ifndef _WIN32 + /* + * PR 2115630. On Linux, use /var/run or /run directory + * to hold the package. + */ + const char *runDir = "/run"; + const char *varRunDir = "/var/run"; + + if (File_IsDirectory(varRunDir)) { + dir = strdup(varRunDir); + if (dir == NULL) { + g_warning("%s: strdup failed\n", __FUNCTION__); + goto exit; + } + } else if (File_IsDirectory(runDir)) { + dir = strdup(runDir); + if (dir == NULL) { + g_warning("%s: strdup failed\n", __FUNCTION__); + goto exit; + } + } +#endif /* * Get system temporary directory. */ - if ((dir = File_GetSafeRandomTmpDir(TRUE)) == NULL) { + if (dir == NULL && (dir = File_GetSafeRandomTmpDir(TRUE)) == NULL) { g_warning("%s: File_GetSafeRandomTmpDir failed\n", __FUNCTION__); goto exit; }