summaryrefslogtreecommitdiff
path: root/src/cgls
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgls')
-rw-r--r--src/cgls/cgls.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index e649b75df6..e01a7b13a1 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -171,19 +171,14 @@ int main(int argc, char *argv[]) {
arg_kernel_threads, output_flags);
} else {
char _cleanup_free_ *root = NULL;
- const char *t = NULL;
- r = cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, 1, &root);
- if (r < 0)
- t = "/";
- else {
- if (endswith(root, "/system"))
- root[strlen(root)-7] = 0;
-
- t = root[0] ? root : "/";
+ r = cg_get_root_path(&root);
+ if (r < 0) {
+ log_error("Failed to get root path: %s", strerror(-r));
+ goto finish;
}
- r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, t, NULL, 0,
+ r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, root, NULL, 0,
arg_kernel_threads, output_flags);
}
}