cgroup: port some code over to path_startswith_full()

This commit is contained in:
Lennart Poettering
2025-05-23 06:51:43 +02:00
parent ee19edbb9f
commit 482107724f
2 changed files with 6 additions and 18 deletions
+4 -10
View File
@@ -2808,19 +2808,13 @@ static int unit_prune_cgroup_via_bus(Unit *u) {
return -EOWNERDEAD;
/* Determine this unit's cgroup path relative to our cgroup root */
const char *pp = path_startswith(crt->cgroup_path, u->manager->cgroup_root);
const char *pp = path_startswith_full(
crt->cgroup_path,
u->manager->cgroup_root,
PATH_STARTSWITH_RETURN_LEADING_SLASH);
if (!pp)
return -EINVAL;
_cleanup_free_ char *absolute = NULL;
if (!path_is_absolute(pp)) { /* RemoveSubgroupFromUnit() wants an absolute path */
absolute = strjoin("/", pp);
if (!absolute)
return -ENOMEM;
pp = absolute;
}
r = bus_call_method(u->manager->system_bus,
bus_systemd_mgr,
"RemoveSubgroupFromUnit",