]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
LXC complement PATH environment variable
authorRyota Ozaki <ozaki.ryota@gmail.com>
Wed, 14 Oct 2009 14:54:29 +0000 (16:54 +0200)
committerDaniel Veillard <veillard@redhat.com>
Wed, 14 Oct 2009 14:54:29 +0000 (16:54 +0200)
* src/lxc/lxc_driver.c: without PATH, the controller will definitely
  fail to call ip command

src/lxc/lxc_driver.c

index 0b614e3bf01ed82e458161639ac923c6ae4d6b2c..783dfccbfbe3ae657fc289cb5cd1c58f0354d206 100644 (file)
@@ -1005,6 +1005,19 @@ static int lxcControllerStart(virConnectPtr conn,
         lenv[lenvc++] = envval;                                         \
     } while (0)
 
+#define ADD_ENV_COPY(envname)                                           \
+    do {                                                                \
+        char *val = getenv(envname);                                    \
+        if (val != NULL) {                                              \
+            ADD_ENV_PAIR(envname, val);                                 \
+        }                                                               \
+    } while (0)
+
+    /*
+     * The controller may call ip command, so we have to remain PATH.
+     */
+    ADD_ENV_COPY("PATH");
+
     log_level = virLogGetDefaultPriority();
     if (virAsprintf(&tmp, "LIBVIRT_DEBUG=%d", log_level) < 0)
         goto no_memory;