]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: make sure a cgroup does not already exist 884/head
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 9 Mar 2016 07:34:19 +0000 (23:34 -0800)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 9 Mar 2016 07:34:19 +0000 (23:34 -0800)
Our mkdir_p ignore eexist, and of course we want that for
upper path components, but the final directory itself must
not already exist.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/cgfsng.c

index 820cd0bd4c61a77d6b1b3774ad37f36298c5d6aa..32213bf62a988b50236c5171849b4fa097180364 100644 (file)
@@ -1031,6 +1031,8 @@ struct cgroup_ops *cgfsng_ops_init(void)
 static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
 {
        h->fullcgpath = must_make_path(h->mountpoint, h->base_cgroup, cgname, NULL);
+       if (dir_exists(h->fullcgpath)) // it must not already exist
+               return false;
        if (!handle_cpuset_hierarchy(h, cgname))
                return false;
        return mkdir_p(h->fullcgpath, 0755) == 0;