----- Original Message -----
> From: "Weng Meiling" <wengmeiling.w...@huawei.com>
> To: "Ivana Varekova" <varek...@redhat.com>
> Cc: "Huang Qiang" <h.huangqi...@huawei.com>, "libo chen" 
> <libo.c...@huawei.com>, "Libcg Development list"
> <libcg-devel@lists.sourceforge.net>
> Sent: Saturday, September 14, 2013 11:48:52 AM
> Subject: [PATCH] cgcreate: fix the wrong uid/gid set.
> 
> 
> From: Weng Meiling <wengmeiling.w...@huawei.com>
> 
> When setting the cgconfig.conf as follow:
> 
> mount {
>       memory = /cgroup/memory;
> }
> 
> group . {
>       perm {
>               task {
>                       gid = w00227741;
>                       uid = w00227741;
>                       fperm =755;
>               }
>               admin {
>                       gid = w00227741;
>                       uid = w00227741;
>                       fperm =755;
>                       dperm = 755;
>               }
>       }
>       memory {
>       }
> }
> 
> and resart the cgconfig service. Then switch to the user w00227741
> and cgreate cgroup like this:
> 
> # lscgroup
> memory:/
> 
> # cgcreate -g memory:test
> cgcreate: can't create cgroup test: Operation not permitted
> 
> the command report the error, but the cgroup test has created:
> 
> # lscgroup
> memory:/
> memory:/test
> 
> this patch fix the problem.
> 
> Signed-off-by: Weng Meiling <wengmeiling.w...@huawei.com>
Acked-by: Ivana Hutarova Varekova <varek...@redhat.com>
> ---
>  src/api.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/api.c b/src/api.c
> index 61b852c..22fc1f3 100644
> --- a/src/api.c
> +++ b/src/api.c
> @@ -119,9 +119,9 @@ static const char const *cgroup_ignored_tasks_files[] = {
> "tasks", NULL };
>  static int cg_chown(const char *filename, uid_t owner, gid_t group)
>  {
>       if (owner == NO_UID_GID)
> -             owner = 0;
> +             owner = getuid();
>       if (group == NO_UID_GID)
> -             group = 0;
> +             group = getgid();
>       return chown(filename, owner, group);
>  }
>  static int cg_chown_file(FTS *fts, FTSENT *ent, uid_t owner, gid_t group)
> --
> 1.7.1
> 
> 
> 

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to