On 05/08/2012 07:56 PM, Ivana Hutarova Varekova wrote: > lscgroup tool in display_controller_data procedure trimmed relative path > name too strictly, thus if the path have no leading "/" sign then the first > character was trimmed too. > > More precisely the relative path is taken from the full path - path to the > controller root and relative path given on command line (with all characters > "/") + character "/" at the end of path. The length of suffix which describe > relative path is count from trimmed relative path given on command line > (without characters "/" at the begining and at the end). There have to be > used the same relative path in both cases and -1 to the lenght. > > CHANGELOG v1: > * more detailed description > * fix the problem with "/" sign at the end of path too > > EXAMPLE > without the patch: > $ lscgroup freezer:libvirt > freezer:/ibvirt/ > freezer:/ibvirt/lxc > freezer:/ibvirt/qemu > > with the patch: > $ lscgroup freezer:libvirt > freezer:/libvirt/ > freezer:/libvirt/lxc > freezer:/libvirt/qemu > > this patch fixes the problem. > > Signed-off-by: Ivana Hutarova Varekova <varek...@redhat.com>
Acked-By: Jan Safranek<jsafr...@redhat.com> > --- > > src/tools/lscgroup.c | 12 ++++++------ > 1 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/src/tools/lscgroup.c b/src/tools/lscgroup.c > index 6ab2103..c16f193 100644 > --- a/src/tools/lscgroup.c > +++ b/src/tools/lscgroup.c > @@ -91,16 +91,16 @@ static int display_controller_data(char *input_path, char > *controller, char *nam > int lvl; > int len; > > - ret = cgroup_walk_tree_begin(controller, input_path, 0, > + strncpy(input_dir_path, input_path, FILENAME_MAX); > + /* remove problematic '/' characters from input path */ > + trim_filepath(input_dir_path); > + > + ret = cgroup_walk_tree_begin(controller, input_dir_path, 0, > &handle, &info, &lvl); > if (ret != 0) > return ret; > > - strncpy(input_dir_path, input_path, FILENAME_MAX); > - /* remove problematic '/' characters from input path*/ > - trim_filepath(input_dir_path); > - > - len = strlen(info.full_path) - strlen(input_dir_path); > + len = strlen(info.full_path) - strlen(input_dir_path) - 1; > print_info(&info, name, len); > while ((ret = cgroup_walk_tree_next(0, &handle, &info, lvl)) == 0) > print_info(&info, name, len); > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Libcg-devel mailing list > Libcg-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libcg-devel ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel