From cfa70b8824e3830482864f97e195f60c12ad9098 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Thu, 23 Oct 2014 04:34:05 +0000 Subject: [PATCH] attach: don't use confstr(_CS_PATH) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/lxc/attach.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) 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")) { -- 2.47.2