]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Common source file changes not directly applicable to open-vm-tools.
authorJohn Wolfe <jwolfe@vmware.com>
Tue, 12 Jul 2022 16:56:01 +0000 (09:56 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Tue, 12 Jul 2022 16:56:01 +0000 (09:56 -0700)
open-vm-tools/libDeployPkg/linuxDeployment.c
open-vm-tools/services/plugins/deployPkg/deployPkg.c

index 2a9b319de90ce1e433657bcd2c1f4933420d3531..b1f9c8dd0bf80c1267826b73a95ce12c723fb945 100644 (file)
@@ -113,6 +113,7 @@ static const char* ERRORED         = "ERRORED";
 #ifndef IMGCUST_UNITTEST
 static const char* RUNDIR          = "/run";
 static const char* VARRUNDIR       = "/var/run";
+static const char* VARRUNIMCDIR    = "/var/run/vmware-imc";
 #endif
 static const char* TMPDIR          = "/tmp";
 
@@ -1327,8 +1328,11 @@ Deploy(const char* packageName)
 #ifdef IMGCUST_UNITTEST
    baseDirPath = TMPDIR;
 #else
+   // PR 2942062, Use /var/run/vmware-imc if the directory exists
    // PR 2127543, Use /var/run or /run but /tmp firstly
-   if (File_IsDirectory(VARRUNDIR)) {
+   if (File_IsDirectory(VARRUNIMCDIR)) {
+      baseDirPath = VARRUNIMCDIR;
+   } else if (File_IsDirectory(VARRUNDIR)) {
       baseDirPath = VARRUNDIR;
    } else if (File_IsDirectory(RUNDIR)) {
       baseDirPath = RUNDIR;
index ddc1728d82ba3af9c6486daa5b508b2aa86bd21a..4d70765a5188e0f5c7b3f3a90d9b891b05a0fc49 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2006-2021 VMware, Inc. All rights reserved.
+ * Copyright (C) 2006-2022 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
@@ -441,23 +441,26 @@ DeployPkgGetTempDir(void)
    int randIndex;
 #ifndef _WIN32
    /*
-    * PR 2115630. On Linux, use /var/run or /run directory
-    * to hold the package.
+    * The directories in the array must be sorted by priority from high to low.
+    * PR 2942062. On Nested ESXi, use /var/run/vmware-imc directory to hold the
+    * package if it exists.
+    * 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;
+   const char *searchDirs[] = {
+      "/var/run/vmware-imc",         // The highest priority
+      "/var/run",
+      "/run"                         // The lowest priority
+   };
+
+   size_t index;
+   for (index = 0; index < ARRAYSIZE(searchDirs); index++) {
+      if (File_IsDirectory(searchDirs[index])) {
+         dir = strdup(searchDirs[index]);
+         if (dir == NULL) {
+            g_warning("%s: strdup failed\n", __FUNCTION__);
+            goto exit;
+         }
+         break;
       }
    }
 #endif