From 50f2ee4576024a1b2cca7a151c50a060e2bb9612 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 4 Jun 2025 20:18:01 +0200 Subject: [PATCH] core/cgroup: don't ever try to get SPECIAL_ROOT_SLICE from Manager.cgroup_unit This tries to query unit name in cgroup_unit hashmap, which always returns NULL. Just return NULL directly instead. --- src/core/cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 6098462025e..2b1d2435a88 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -3413,7 +3413,7 @@ Unit* manager_get_unit_by_cgroup(Manager *m, const char *cgroup) { e = strrchr(p, '/'); if (!e || e == p) - return hashmap_get(m->cgroup_unit, SPECIAL_ROOT_SLICE); + return NULL; /* reached cgroup root? return NULL and possibly fall back to manager_get_unit_by_pidref_watching() */ *e = 0; @@ -3423,7 +3423,7 @@ Unit* manager_get_unit_by_cgroup(Manager *m, const char *cgroup) { } } -Unit *manager_get_unit_by_pidref_cgroup(Manager *m, const PidRef *pid) { +Unit* manager_get_unit_by_pidref_cgroup(Manager *m, const PidRef *pid) { _cleanup_free_ char *cgroup = NULL; assert(m); -- 2.47.3