cgroup-setup: use path_join() to get path to cgroup attribute

We already have the path to the cgroup. Hence, it is not necessary to
call cg_get_path() again.
This commit is contained in:
Yu Watanabe
2025-04-16 03:56:04 +09:00
parent 188286eec6
commit b2b270e1d1
+5 -7
View File
@@ -222,18 +222,16 @@ int cg_set_access(
/* Configure access to the cgroup's attributes */
FOREACH_ELEMENT(i, attributes) {
fs = mfree(fs);
_cleanup_free_ char *a = path_join(fs, i->name);
if (!a)
return -ENOMEM;
r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, path, i->name, &fs);
if (r < 0)
return r;
r = chmod_and_chown(fs, 0644, uid, gid);
r = chmod_and_chown(a, 0644, uid, gid);
if (r < 0) {
if (i->fatal)
return r;
log_debug_errno(r, "Failed to set access on cgroup %s, ignoring: %m", fs);
log_debug_errno(r, "Failed to set access on cgroup %s, ignoring: %m", a);
}
}