Commit aea0e3ec by Serge Hallyn Committed by Stéphane Graber

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/1384327Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent fb4cf517
...@@ -336,23 +336,8 @@ static int lxc_attach_set_environment(enum lxc_attach_env_policy_t policy, char* ...@@ -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 * number of C programs out there that just assume
* that getenv("PATH") is never NULL and then die a * that getenv("PATH") is never NULL and then die a
* painful segfault death. */ * painful segfault death. */
if (!path_kept) { 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
setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1); setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
#endif
}
} }
if (putenv("container=lxc")) { if (putenv("container=lxc")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment