cgroup: port some code over to path_startswith_full()
This commit is contained in:
+4
-10
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user