]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: cgfsng_create()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 17 Feb 2018 18:27:52 +0000 (19:27 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 17 Feb 2018 18:27:52 +0000 (19:27 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 5f53aee036b1d981cd15cfc17f5827a1032ee456..9e8a1ca31ae4f114b5c1210c10f4a9b504cf4cf8 100644 (file)
@@ -1765,9 +1765,8 @@ static void remove_path_for_hierarchy(struct hierarchy *h, char *cgname)
        h->fullcgpath = NULL;
 }
 
-/*
- * Try to create the same cgroup in all hierarchies.
- * Start with cgroup_pattern; next cgroup_pattern-1, -2, ..., -999
+/* Try to create the same cgroup in all hierarchies. Start with cgroup_pattern;
+ * next cgroup_pattern-1, -2, ..., -999.
  */
 static inline bool cgfsng_create(void *hdata)
 {
@@ -1804,6 +1803,7 @@ again:
                ERROR("Too many conflicting cgroup names");
                goto out_free;
        }
+
        if (idx) {
                int ret;
 
@@ -1818,10 +1818,11 @@ again:
                        }
                }
        }
+
        for (i = 0; hierarchies[i]; i++) {
                if (!create_path_for_hierarchy(hierarchies[i], container_cgroup)) {
                        int j;
-                       ERROR("Failed to create \"%s\"", hierarchies[i]->fullcgpath);
+                       ERROR("Failed to create cgroup \"%s\"", hierarchies[i]->fullcgpath);
                        free(hierarchies[i]->fullcgpath);
                        hierarchies[i]->fullcgpath = NULL;
                        for (j = 0; j < i; j++)
@@ -1830,12 +1831,14 @@ again:
                        goto again;
                }
        }
-       /* Done */
+
        d->container_cgroup = container_cgroup;
+
        return true;
 
 out_free:
        free(container_cgroup);
+
        return false;
 }