Commit b4b43e9e by Christian Brauner Committed by GitHub

Merge pull request #1058 from hallyn/2016-06-24/eric.cgns

container start: clone newcgroup immediately
parents 0fa988d1 9fac8fbb
......@@ -934,11 +934,6 @@ static int do_start(void *data)
devnull_fd = -1;
}
if (cgns_supported() && unshare(CLONE_NEWCGROUP) != 0) {
SYSERROR("Failed to unshare cgroup namespace");
goto out_warn_father;
}
setsid();
/* after this call, we are in error because this
......@@ -1161,7 +1156,11 @@ static int lxc_spawn(struct lxc_handler *handler)
flags = handler->clone_flags;
if (handler->clone_flags & CLONE_NEWUSER)
flags &= ~CLONE_NEWNET;
handler->pid = lxc_clone(do_start, handler, handler->clone_flags);
if (cgns_supported()) {
handler->clone_flags |= CLONE_NEWCGROUP;
flags |= CLONE_NEWCGROUP;
}
handler->pid = lxc_clone(do_start, handler, flags);
if (handler->pid < 0) {
SYSERROR("failed to fork into a new namespace");
goto out_delete_net;
......
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