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 <jsafr...@redhat.com> --- src/tools/lscgroup.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/tools/lscgroup.c b/src/tools/lscgroup.c index 0b3e502..6ebf8d4 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); ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel