From: Yu Watanabe Date: Mon, 14 Apr 2025 21:12:05 +0000 (+0900) Subject: cgroup-setup: use path_join() to get path to cgroup attribute X-Git-Tag: v258-rc1~812^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F37026%2Fhead;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c index f4d93c2cb07..51f04e8c6b5 100644 --- a/src/shared/cgroup-setup.c +++ b/src/shared/cgroup-setup.c @@ -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); } }