From: Lennart Poettering Date: Mon, 31 Aug 2015 17:43:54 +0000 (+0200) Subject: cgtop: properly show "/" instead of empty string in cgroup list X-Git-Tag: v226~54^2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9660efb82fa8043f47023617a205e3796414ce5c;p=thirdparty%2Fsystemd.git cgtop: properly show "/" instead of empty string in cgroup list --- diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index 06a43d15e42..ae562ba135b 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);