From d8da679e2a3b49ea389297dfd67e8c18bbb70116 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Tue, 8 Mar 2016 23:34:19 -0800 Subject: [PATCH] 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 --- src/lxc/cgfsng.c | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.47.2