Commit eaee6042 authored by Pavel Emelyanov's avatar Pavel Emelyanov

Revert "util: Add "/bin" to PATH when spawning helpers"

This reverts commit 66ab5e1a.

After Andrey's fixes that create mount points before dropping
old mounts and going to pivot_root, this patch is not needed.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e61259a8
...@@ -481,47 +481,6 @@ int run_scripts(char *action) ...@@ -481,47 +481,6 @@ int run_scripts(char *action)
ret__; \ ret__; \
}) })
static int fixup_env(void)
{
char *ep, *nep;
int len;
/*
* FIXME
*
* We sometimes call other tools inside namespace
* we restore. Host system may not have PATH properly
* reflecting where the tools are in other namespaces.
*
* E.g. when restoring Centos6 container from FC20
* host we fail to find /bin/tar, as in FC20 /bin is
* not in PATH.
*
* It's not cool at all, things we think we call might
* not coincide with what is really called. Proper fix
* will come a bit later.
*/
ep = getenv("PATH");
if (!ep)
return 0;
len = strlen(ep);
nep = xmalloc(len + sizeof("/bin:"));
if (!nep)
return -1;
sprintf(nep, "/bin:%s", ep);
if (setenv("PATH", nep, 1)) {
pr_perror("Failed to override PATH");
xfree(nep);
return -1;
}
xfree(nep);
return 0;
}
/* /*
* If "in" is negative, stdin will be closed. * If "in" is negative, stdin will be closed.
* If "out" or "err" are negative, a log file descriptor will be used. * If "out" or "err" are negative, a log file descriptor will be used.
...@@ -544,9 +503,6 @@ int cr_system(int in, int out, int err, char *cmd, char *const argv[]) ...@@ -544,9 +503,6 @@ int cr_system(int in, int out, int err, char *cmd, char *const argv[])
pr_perror("fork() failed"); pr_perror("fork() failed");
goto out; goto out;
} else if (pid == 0) { } else if (pid == 0) {
if (fixup_env())
goto out_chld;
if (out < 0) if (out < 0)
out = log_get_fd(); out = log_get_fd();
if (err < 0) if (err < 0)
......
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