From: Serge Hallyn Date: Thu, 23 Oct 2014 04:34:05 +0000 (+0000) Subject: attach: don't use confstr(_CS_PATH) X-Git-Tag: lxc-1.1.0.alpha3~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfa70b8824e3830482864f97e195f60c12ad9098;p=thirdparty%2Flxc.git attach: don't use confstr(_CS_PATH) It is not system-definable, rather glibc sets that to bin:/usr/bin, which is simply too restrictive. So just always set our preferred path. This was reported at: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1384327 Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index 7cadcbdcb..231801869 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -336,23 +336,8 @@ static int lxc_attach_set_environment(enum lxc_attach_env_policy_t policy, char* * number of C programs out there that just assume * that getenv("PATH") is never NULL and then die a * painful segfault death. */ - if (!path_kept) { -#ifdef HAVE_CONFSTR - size_t n; - char *path_env; - - n = confstr(_CS_PATH, NULL, 0); - path_env = malloc(n); - if (path_env) { - confstr(_CS_PATH, path_env, n); - setenv("PATH", path_env, 1); - free(path_env); - } - /* don't error out, this is just an extra service */ -#else + if (!path_kept) setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1); -#endif - } } if (putenv("container=lxc")) {