Hi All,

When we invoke cgroup_get_cgroup() to get the cgroup meta data, the admin_id and admin_gid are not displayed correctly. This is because cgroup_fill_cgc() does not differentiate between the cgroup control files and tasks file. So cgroup->control_uid and cgroup->control_gid fields are getting populated with the uid and gid of tasks file.

This patch fixes this problem by adding a check in the cgroup_fill_cgc() function to see if the file is a 'tasks' file or not.

-Ciju



Signed-off-by: Ciju Rajan K <[email protected]>
---
 api.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- libcgroup-0.37.rc1/src/api.c.orig   2010-12-10 15:01:36.000000000 +0530
+++ libcgroup-0.37.rc1/src/api.c        2010-12-10 15:03:26.000000000 +0530
@@ -1941,8 +1941,10 @@ static int cgroup_fill_cgc(struct dirent
                goto fill_error;
        }
 
-       cgroup->control_uid = stat_buffer.st_uid;
-       cgroup->control_gid = stat_buffer.st_gid;
+       if (!strstr(path, "tasks")) {
+               cgroup->control_uid = stat_buffer.st_uid;
+               cgroup->control_gid = stat_buffer.st_gid;
+       }
 
        ctrl_name = strtok_r(d_name, ".", &buffer);
 
------------------------------------------------------------------------------
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to