From d9afece42d63a3b4e6646c805b5e2c7a5ccf1055 Mon Sep 17 00:00:00 2001 From: Ivana Hutarova Varekova Date: Thu, 18 Jul 2013 12:51:41 +0200 Subject: [PATCH] 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 --- src/config.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.47.2