]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
if a hierarchy with more controllers is parsed before hierarchy with less
authorJan Safranek <jsafrane@redhat.com>
Thu, 2 Dec 2010 14:00:40 +0000 (15:00 +0100)
committerJan Safranek <jsafrane@redhat.com>
Thu, 2 Dec 2010 14:00:40 +0000 (15:00 +0100)
controllers as the last two hierarchies, then the output of cgsnapshot is
broken - test is missing

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
src/tools/cgsnapshot.c

index 198fdd7fae195b022a3744e0f99b947b0fd4b541..b5710a3543a7981434306ddfaf7c7001388da029 100644 (file)
@@ -553,9 +553,11 @@ static int parse_controllers(cont_name_t cont_names[CG_CONTROLLER_MAX],
                ret = cgroup_get_controller_next(&handle, &controller);
        }
 
-       if (max != 0)
+       if (max != 0) {
+               (controllers[max])[0] = '\0';
                ret = display_controller_data(
                        controllers, program_name);
+       }
 
        cgroup_get_controller_end(&handle);
        if (ret != ECGEOF)