On 06/05/2012 12:19 PM, Ivana Hutarova Varekova wrote:
> The present version of lscgroup remove / signs at instead of the beginning 
> ones
at what?                                         ^^^

And what is it good for?

> 
> 
> Example
> old version:
> $ lscgroup memory://abc///
> memory:/abc///
> memory:/abc///gh
> memory:/abc///def
> 
> 
> new version:
> $ lscgroup memory://abc///
> memory://abc///
> memory://abc///gh
> memory://abc///def

old vesion
$ lscgroup
blkio:/
blkio:/libvirt
blkio:/libvirt/lxc
blkio:/libvirt/qemu

new version:
$ lscgroup
blkio://
blkio://libvirt
blkio://libvirt/lxc
blkio://libvirt/qemu

-> additional '/' appears -> NACK.

> 
> 
> Signed-off-by: Ivana Hutarova Varekova <varek...@redhat.com>
> ---
> 
>  src/tools/lscgroup.c |   17 +++++++++++------
>  1 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/src/tools/lscgroup.c b/src/tools/lscgroup.c
> index c16f193..af98e48 100644
> --- a/src/tools/lscgroup.c
> +++ b/src/tools/lscgroup.c
> @@ -87,20 +87,25 @@ static int display_controller_data(char *input_path, char 
> *controller, char *nam
>       int ret;
>       void *handle;
>       struct cgroup_file_info info;
> +     char cgroup_dir_path[FILENAME_MAX];
>       char input_dir_path[FILENAME_MAX];
>       int lvl;
>       int len;
>  
> -     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,
> +     ret = cgroup_walk_tree_begin(controller, input_path, 0,
>               &handle, &info, &lvl);
>       if (ret != 0)
>               return ret;
>  
> -     len  = strlen(info.full_path) - strlen(input_dir_path) - 1;
> +     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 directory path*/
> +     trim_filepath(input_dir_path);
> +     len  = strlen(cgroup_dir_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);
> 
> 
> ------------------------------------------------------------------------------
> 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

Reply via email to