summaryrefslogtreecommitdiff
path: root/src/cgtop/cgtop.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-08-31 19:43:54 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-01 17:20:56 +0200
commit9660efb82fa8043f47023617a205e3796414ce5c (patch)
treeb1e7517a88b3d249cd52d2d089d13131cf772817 /src/cgtop/cgtop.c
parentbd9f2fc2d080e0ab3de8d159cc98aa5948007d37 (diff)
cgtop: properly show "/" instead of empty string in cgroup list
Diffstat (limited to 'src/cgtop/cgtop.c')
-rw-r--r--src/cgtop/cgtop.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 06a43d15e4..ae562ba135 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -560,15 +560,17 @@ static void display(Hashmap *a) {
path_columns = maxtpath;
for (j = 0; j < n; j++) {
- _cleanup_free_ char *p = NULL;
+ _cleanup_free_ char *ellipsized = NULL;
+ const char *path;
if (on_tty() && j + 5 > rows)
break;
g = array[j];
- p = ellipsize(g->path, path_columns, 33);
- printf("%-*s", path_columns, p ?: g->path);
+ path = isempty(g->path) ? "/" : g->path;
+ ellipsized = ellipsize(path, path_columns, 33);
+ printf("%-*s", path_columns, ellipsized ?: path);
if (g->n_tasks_valid)
printf(" %7u", g->n_tasks);