]> git.proxmox.com Git - mirror_lxc.git/commitdiff
attach: don't use confstr(_CS_PATH)
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 23 Oct 2014 04:34:05 +0000 (04:34 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 27 Oct 2014 21:02:07 +0000 (17:02 -0400)
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 <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/attach.c

index 7cadcbdcb8344acde95f8139221ccf6039428770..2318018692bb194a72f278a5dacb636d6cf08fd7 100644 (file)
@@ -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")) {