]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/cgroup: don't ever try to get SPECIAL_ROOT_SLICE from Manager.cgroup_unit
authorMike Yuan <me@yhndnzj.com>
Wed, 4 Jun 2025 18:18:01 +0000 (20:18 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 4 Jun 2025 20:03:47 +0000 (22:03 +0200)
This tries to query unit name in cgroup_unit hashmap, which
always returns NULL. Just return NULL directly instead.

src/core/cgroup.c

index 6098462025e11147d2b7058554067d65fa8d8de7..2b1d2435a88de5410b07f01c8a0c552d783c2243 100644 (file)
@@ -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) {
+Unitmanager_get_unit_by_pidref_cgroup(Manager *m, const PidRef *pid) {
         _cleanup_free_ char *cgroup = NULL;
 
         assert(m);