mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-06 01:45:47 +00:00
attach: unshare cgroupns if possible
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> --- Changelog 20160104: only try if kernel supports cgns.
This commit is contained in:
parent
12983ba458
commit
6cee93ac80
@ -957,6 +957,13 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
|
||||
WARN("could not change directory to '%s'", new_cwd);
|
||||
free(cwd);
|
||||
|
||||
if (options->attach_flags & LXC_ATTACH_MOVE_TO_CGROUP && cgns_supported()) {
|
||||
if (unshare(CLONE_NEWCGROUP) != 0) {
|
||||
SYSERROR("cgroupns unshare: permission denied");
|
||||
rexit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/* now create the real child process */
|
||||
{
|
||||
struct attach_clone_payload payload = {
|
||||
|
Loading…
Reference in New Issue
Block a user