Unverified Commit 483f5b4f by Stéphane Graber Committed by GitHub

Merge pull request #3897 from brauner/2021-07-05.fixes

lxc-unshare: fixes
parents b235962c a1ac2680
...@@ -246,8 +246,13 @@ static int do_start(void *arg) ...@@ -246,8 +246,13 @@ static int do_start(void *arg)
} }
} }
if ((start_arg->flags & CLONE_NEWNS) && start_arg->want_default_mounts) if (start_arg->flags & CLONE_NEWNS) {
lxc_setup_fs(); if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0) < 0)
_exit(EXIT_FAILURE);
if (start_arg->want_default_mounts)
lxc_setup_fs();
}
if ((start_arg->flags & CLONE_NEWUTS) && want_hostname) if ((start_arg->flags & CLONE_NEWUTS) && want_hostname)
if (sethostname(want_hostname, strlen(want_hostname)) < 0) { if (sethostname(want_hostname, strlen(want_hostname)) < 0) {
...@@ -411,7 +416,7 @@ int main(int argc, char *argv[]) ...@@ -411,7 +416,7 @@ int main(int argc, char *argv[])
if (lpid == 0) { if (lpid == 0) {
char buf[256]; char buf[256];
ret = snprintf(buf, 256, "%d", lpid); ret = snprintf(buf, 256, "%d", pid);
if (ret < 0 || ret >= 256) if (ret < 0 || ret >= 256)
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
...@@ -420,8 +425,7 @@ int main(int argc, char *argv[]) ...@@ -420,8 +425,7 @@ int main(int argc, char *argv[])
} }
if (wait_for_pid(lpid) != 0) if (wait_for_pid(lpid) != 0)
SYSERROR("Could not move interface \"%s\" into container %d", SYSERROR("Could not move interface \"%s\" into container %d", ifname, lpid);
ifname, lpid);
} }
free_ifname_list(); free_ifname_list();
......
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