From: Serge Hallyn Date: Wed, 9 Mar 2016 07:34:19 +0000 (-0800) Subject: cgfsng: make sure a cgroup does not already exist X-Git-Tag: lxc-2.0.0.rc9~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F884%2Fhead;p=thirdparty%2Flxc.git cgfsng: make sure a cgroup does not already exist 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 --- diff --git a/src/lxc/cgfsng.c b/src/lxc/cgfsng.c index 820cd0bd4..32213bf62 100644 --- a/src/lxc/cgfsng.c +++ b/src/lxc/cgfsng.c @@ -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;