On 10/21/2010 02:35 PM, Ivana Hutarova Varekova wrote:
> Because cgpconfigparser changes the permissions of all files there have to be 
> checked the permissions of files in root group to set vhether the variable i 
> s writable or not.
>
> Signed-off-by: Ivana Hutarova Varekova<[email protected]>

Acked-By: Jan Safranek <[email protected]>

> ---
>
>   src/tools/cgsnapshot.c |   10 ++++++----
>   1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/tools/cgsnapshot.c b/src/tools/cgsnapshot.c
> index dcab130..caecc3a 100644
> --- a/src/tools/cgsnapshot.c
> +++ b/src/tools/cgsnapshot.c
> @@ -273,7 +273,7 @@ static int display_permissions(const char *path,
>
>   static int display_cgroup_data(struct cgroup *group,
>               char controller[CG_CONTROLLER_MAX][FILENAME_MAX],
> -             const char *group_path, int first,
> +             const char *group_path, int root_path_len, int first,
>               const char *program_name)
>   {
>       int i = 0, j;
> @@ -315,8 +315,10 @@ static int display_cgroup_data(struct cgroup *group,
>               for (j = 0; j<  nr_var; j++) {
>                       name = cgroup_get_value_name(group_controller, j);
>
> -                     /* test whether the variable file is writable */
> -                     strncpy(var_path, group_path, FILENAME_MAX);
> +                     /* test whether the variable file in root group
> +                        is writable */
> +                     strncpy(var_path, group_path, root_path_len);
> +                     var_path[root_path_len] = '\0';
>                       strncat(var_path, "/", FILENAME_MAX);
>                       var_path[FILENAME_MAX-1] = '\0';
>                       strncat(var_path, name, FILENAME_MAX);
> @@ -452,7 +454,7 @@ static int display_controller_data(
>                       }
>
>                       display_cgroup_data(group, controller, info.full_path,
> -                             first, program_name);
> +                             prefix_len, first, program_name);
>                       first = 0;
>               }
>       }
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps&  games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Libcg-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libcg-devel


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to