mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07: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:
@@ -339,6 +339,10 @@ static int cgroup_create(const char *group, const char *name, const char *cfg,
|
||||
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++) {
|
||||
snprintf(filepath, sizeof(filepath), "%s/%s", path, files[i]);
|
||||
if (chown(filepath, uid, gid))
|
||||
|
||||
Reference in New Issue
Block a user