From: Ivana Hutarova Varekova Date: Thu, 18 Jul 2013 10:51:41 +0000 (+0200) Subject: config.c: better detect whether template group already is created X-Git-Tag: v0.41~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9afece42d63a3b4e6646c805b5e2c7a5ccf1055;p=thirdparty%2Flibcgroup.git config.c: better detect whether template group already is created cgroup_config_create_template_group: properly detect whether template group was created Signed-off-by: Ivana Hutarova Varekova Acked-by: Jan Safranek --- diff --git a/src/config.c b/src/config.c index b2b8a135..06f559be 100644 --- a/src/config.c +++ b/src/config.c @@ -1566,6 +1566,7 @@ int cgroup_config_create_template_group(struct cgroup *cgroup, char buffer[FILENAME_MAX]; struct cgroup *aux_cgroup; struct cgroup_controller *cgc; + int found; /* * If the user did not ask for cached rules, we must parse the @@ -1590,6 +1591,7 @@ int cgroup_config_create_template_group(struct cgroup *cgroup, /* for each controller we have to add to cgroup structure * either template cgroup or empty controller */ + found = 0; /* look for relevant template - test name x controller pair */ for (j = 0; j < template_table_index; j++) { @@ -1625,12 +1627,16 @@ int cgroup_config_create_template_group(struct cgroup *cgroup, } else { /* go to new controller */ j = template_table_index; + found = 1; continue; } } } + if (found == 1) + continue; + /* no template is present for given name x controller pair * add controller to result cgroup */ aux_cgroup = cgroup_new_cgroup(cgroup->name);