From c396fb36fa167b34f150cddaa5ca5d9c37f20a82 Mon Sep 17 00:00:00 2001 From: Ryota Ozaki Date: Wed, 14 Oct 2009 16:54:29 +0200 Subject: [PATCH] LXC complement PATH environment variable * src/lxc/lxc_driver.c: without PATH, the controller will definitely fail to call ip command --- src/lxc/lxc_driver.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 0b614e3bf0..783dfccbfb 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -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; -- GitLab