mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00:00
cgroups: non-root service cannot create child cgroups
The kernel delegation docs require write access on the directory so the delegatee can mkdir() children. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
d2781ef655
commit
a35ed8f72e
1 file changed
+4
@@ -339,6 +339,10 @@ static int cgroup_create(const char *group, const char *name, const char *cfg,
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* non-root delegated services needs permission to mkdir() */
|
||||||
|
if (chown(path, uid, gid))
|
||||||
|
warn("Failed chown %s to %d:%d", path, uid, gid);
|
||||||
|
|
||||||
for (int i = 0; files[i]; i++) {
|
for (int i = 0; files[i]; i++) {
|
||||||
snprintf(filepath, sizeof(filepath), "%s/%s", path, files[i]);
|
snprintf(filepath, sizeof(filepath), "%s/%s", path, files[i]);
|
||||||
if (chown(filepath, uid, gid))
|
if (chown(filepath, uid, gid))
|
||||||
|
|||||||
Reference in new issue
Block a user