From 7a36c539b62fb24039ee3a36d300fc3b64a034f3 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Mon, 21 Nov 2011 13:55:46 +0100 Subject: [PATCH] lscgroup: Fixed too many '/' characters on output Fix the calculation of path prefixes and prevent addtional slashes in libcgroup output. I.e. instead of: $ lscgroup cpu:/ cpu:/// cpu:///system show: $ lscgroup cpu:/ cpu:/ cpu:/system Signed-off-by: Jan Safranek Acked-by: Balbir Singh --- src/tools/lscgroup.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/tools/lscgroup.c b/src/tools/lscgroup.c index 0b3e502f..6ebf8d4f 100644 --- a/src/tools/lscgroup.c +++ b/src/tools/lscgroup.c @@ -97,15 +97,11 @@ static int display_controller_data(char *input_path, char *controller, char *nam if (ret != 0) return ret; - strncpy(cgroup_dir_path, info.full_path, FILENAME_MAX); - /* remove problematic '/' characters from cgroup directory path*/ - trim_filepath(cgroup_dir_path); - strncpy(input_dir_path, input_path, FILENAME_MAX); /* remove problematic '/' characters from input path*/ - trim_filepath(cgroup_dir_path); + trim_filepath(input_dir_path); - len = strlen(cgroup_dir_path) - strlen(input_dir_path) + 1; + len = strlen(info.full_path) - strlen(input_dir_path); print_info(&info, name, len); while ((ret = cgroup_walk_tree_next(0, &handle, &info, lvl)) == 0) print_info(&info, name, len); -- 2.47.2