mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-16 09:01:09 +00:00
Merge pull request #3897 from brauner/2021-07-05.fixes
lxc-unshare: fixes
This commit is contained in:
commit
483f5b4f3d
@ -246,8 +246,13 @@ static int do_start(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
if ((start_arg->flags & CLONE_NEWNS) && start_arg->want_default_mounts)
|
||||
lxc_setup_fs();
|
||||
if (start_arg->flags & CLONE_NEWNS) {
|
||||
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 (sethostname(want_hostname, strlen(want_hostname)) < 0) {
|
||||
@ -411,7 +416,7 @@ int main(int argc, char *argv[])
|
||||
if (lpid == 0) {
|
||||
char buf[256];
|
||||
|
||||
ret = snprintf(buf, 256, "%d", lpid);
|
||||
ret = snprintf(buf, 256, "%d", pid);
|
||||
if (ret < 0 || ret >= 256)
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
@ -420,8 +425,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (wait_for_pid(lpid) != 0)
|
||||
SYSERROR("Could not move interface \"%s\" into container %d",
|
||||
ifname, lpid);
|
||||
SYSERROR("Could not move interface \"%s\" into container %d", ifname, lpid);
|
||||
}
|
||||
|
||||
free_ifname_list();
|
||||
|
Loading…
Reference in New Issue
Block a user