summaryrefslogtreecommitdiffstats
path: root/api.c
diff options
context:
space:
mode:
authorDhaval Giani <dhaval@linux.vnet.ibm.com>2008-12-17 12:29:12 +0000
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2008-12-17 12:29:12 +0000
commit4091c043bf7ab0d2f8e12771c4b5d2b63ade89dd (patch)
tree2d1f04cc0b56ff1e5798d2d1feda35607085543a /api.c
parentdb31da44a34b96e4c242a737a7cb1bdea2c3ce1c (diff)
downloadlibcg-4091c043bf7ab0d2f8e12771c4b5d2b63ade89dd.tar.gz
libcg-4091c043bf7ab0d2f8e12771c4b5d2b63ade89dd.tar.xz
libcg-4091c043bf7ab0d2f8e12771c4b5d2b63ade89dd.zip
libcgroup: Give write access to the group as well
Though we had group details to allow groups access to the cgroup fs, we had not given the group write access. Correct this bug. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@239 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'api.c')
-rw-r--r--api.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/api.c b/api.c
index b5bb8ee..0a65270 100644
--- a/api.c
+++ b/api.c
@@ -111,11 +111,22 @@ static int cg_chown_file(FTS *fts, FTSENT *ent, uid_t owner, gid_t group)
case FTS_NS:
case FTS_DNR:
case FTS_DP:
+ ret = chown(filename, owner, group);
+ if (ret)
+ goto fail_chown;
+ ret = chmod(filename, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |
+ S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ break;
case FTS_F:
case FTS_DEFAULT:
ret = chown(filename, owner, group);
+ if (ret)
+ goto fail_chown;
+ ret = chmod(filename, S_IRUSR | S_IWUSR | S_IRGRP |
+ S_IWGRP | S_IROTH);
break;
}
+fail_chown:
return ret;
}