Unverified Commit da3dcce6 by Stéphane Graber Committed by GitHub

Merge pull request #1906 from brauner/2017-11-06/cgns_check_before_preserve

start: only preserve CLONE_NEWCGROUP when supported
parents eb42a0de baed7c1b
...@@ -1402,13 +1402,15 @@ static int lxc_spawn(struct lxc_handler *handler) ...@@ -1402,13 +1402,15 @@ static int lxc_spawn(struct lxc_handler *handler)
if (lxc_sync_barrier_child(handler, LXC_SYNC_READY_START)) if (lxc_sync_barrier_child(handler, LXC_SYNC_READY_START))
return -1; return -1;
ret = lxc_preserve_ns(handler->pid, "cgroup"); if (cgns_supported()) {
if (ret < 0) { ret = lxc_preserve_ns(handler->pid, "cgroup");
ERROR("%s - Failed to preserve cgroup namespace", strerror(errno)); if (ret < 0) {
goto out_delete_net; ERROR("%s - Failed to preserve cgroup namespace", strerror(errno));
goto out_delete_net;
}
handler->nsfd[LXC_NS_CGROUP] = ret;
DEBUG("Preserved cgroup namespace via fd %d", ret);
} }
handler->nsfd[LXC_NS_CGROUP] = ret;
DEBUG("Preserved cgroup namespace via fd %d", ret);
if (lxc_network_recv_name_and_ifindex_from_child(handler) < 0) { if (lxc_network_recv_name_and_ifindex_from_child(handler) < 0) {
ERROR("Failed to receive names and ifindices for network " ERROR("Failed to receive names and ifindices for network "
......
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