From: Lennart Poettering Date: Wed, 13 Mar 2019 16:44:11 +0000 (+0100) Subject: bus-unit-procs: use empty_or_root() where appropriate X-Git-Tag: v242-rc1~131^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1b63cc6ea932edd1f93c3d2a78c9e34b1c7e52f0;p=thirdparty%2Fsystemd.git bus-unit-procs: use empty_or_root() where appropriate --- diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c index bf71e3b5462..23c5a12454c 100644 --- a/src/shared/bus-unit-procs.c +++ b/src/shared/bus-unit-procs.c @@ -5,6 +5,7 @@ #include "list.h" #include "locale-util.h" #include "macro.h" +#include "path-util.h" #include "process-util.h" #include "sort-util.h" #include "string-util.h" @@ -23,10 +24,6 @@ struct CGroupInfo { size_t n_children; }; -static bool IS_ROOT(const char *p) { - return isempty(p) || streq(p, "/"); -} - static int add_cgroup(Hashmap *cgroups, const char *path, bool is_const, struct CGroupInfo **ret) { struct CGroupInfo *parent = NULL, *cg; int r; @@ -34,7 +31,7 @@ static int add_cgroup(Hashmap *cgroups, const char *path, bool is_const, struct assert(cgroups); assert(ret); - if (IS_ROOT(path)) + if (empty_or_root(path)) path = "/"; cg = hashmap_get(cgroups, path); @@ -43,7 +40,7 @@ static int add_cgroup(Hashmap *cgroups, const char *path, bool is_const, struct return 0; } - if (!IS_ROOT(path)) { + if (!empty_or_root(path)) { const char *e, *pp; e = strrchr(path, '/'); @@ -153,7 +150,7 @@ static int dump_processes( assert(prefix); - if (IS_ROOT(cgroup_path)) + if (empty_or_root(cgroup_path)) cgroup_path = "/"; cg = hashmap_get(cgroups, cgroup_path);