]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: handle missing CLONE_NEWCGROUP 2780/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 10 Jan 2019 12:35:42 +0000 (13:35 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 10 Jan 2019 12:55:55 +0000 (13:55 +0100)
If cgroup namespaces are not supported we should just record it in the
log and move on.

Cc: Ondrej Kubik <ondrej.kubik@canonical.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index dae3bcfe534704514589afec5f0e24b69edf9459..49c2018cacd192633b54035355b258b89f8c6969 100644 (file)
@@ -1252,10 +1252,16 @@ static int do_start(void *data)
        if (handler->ns_clone_flags & CLONE_NEWCGROUP) {
                ret = unshare(CLONE_NEWCGROUP);
                if (ret < 0) {
-                       INFO("Failed to unshare CLONE_NEWCGROUP");
-                       goto out_warn_father;
+                       if (errno != EINVAL) {
+                               SYSERROR("Failed to unshare CLONE_NEWCGROUP");
+                               goto out_warn_father;
+                       }
+
+                       handler->ns_clone_flags &= ~CLONE_NEWCGROUP;
+                       SYSINFO("Kernel does not support CLONE_NEWCGROUP");
+               } else {
+                       INFO("Unshared CLONE_NEWCGROUP");
                }
-               INFO("Unshared CLONE_NEWCGROUP");
        }
 
        /* Add the requested environment variables to the current environment to