Skip to content

Commit

Permalink
lxc_unshare: make mount table private
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jul 12, 2021
1 parent 37f188d commit 37324c2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lxc/tools/lxc_unshare.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 37324c2

Please sign in to comment.