From 9fe837d529e18b36bba045e6e0ea7f5eadae5f70 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 4 Jun 2025 20:30:59 +0200 Subject: [PATCH] core/unit-printf: port to unit_get_cgroup_path_with_fallback() --- src/core/unit-printf.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c index 2b35a1b2a92..7c8bf991507 100644 --- a/src/core/unit-printf.c +++ b/src/core/unit-printf.c @@ -88,14 +88,10 @@ static void bad_specifier(const Unit *u, char specifier) { static int specifier_cgroup(char specifier, const void *data, const char *root, const void *userdata, char **ret) { const Unit *u = ASSERT_PTR(userdata); - CGroupRuntime *crt = unit_get_cgroup_runtime(u); bad_specifier(u, specifier); - if (crt && crt->cgroup_path) - return strdup_to(ret, crt->cgroup_path); - - return unit_default_cgroup_path(u, ret); + return unit_get_cgroup_path_with_fallback(u, ret); } static int specifier_cgroup_root(char specifier, const void *data, const char *root, const void *userdata, char **ret) { @@ -112,14 +108,8 @@ static int specifier_cgroup_slice(char specifier, const void *data, const char * bad_specifier(u, specifier); slice = UNIT_GET_SLICE(u); - if (slice) { - CGroupRuntime *crt = unit_get_cgroup_runtime(slice); - - if (crt && crt->cgroup_path) - return strdup_to(ret, crt->cgroup_path); - - return unit_default_cgroup_path(slice, ret); - } + if (slice) + return unit_get_cgroup_path_with_fallback(slice, ret); return strdup_to(ret, u->manager->cgroup_root); } -- 2.47.3