return -ENOENT;
r = unit_realize_cgroup(u);
- if (r < 0) {
- log_error("Failed to realize cgroup: %s", strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to realize cgroup: %m");
r = cg_attach_many_everywhere(u->manager->cgroup_supported, u->cgroup_path, UNIT(s)->pids);
if (r < 0)
}
static bool scope_check_gc(Unit *u) {
- Scope *s = SCOPE(u);
- int r;
-
- assert(s);
+ assert(u);
/* Never clean up scopes that still have a process around,
* even if the scope is formally dead. */
if (u->cgroup_path) {
+ int r;
+
r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, true);
if (r <= 0)
return true;