chiark / gitweb /
cgtop: fix assert when not on tty
authorUmut Tezduyar Lindskog <umut.tezduyar@axis.com>
Wed, 11 Mar 2015 10:24:18 +0000 (11:24 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Wed, 11 Mar 2015 15:59:53 +0000 (16:59 +0100)
systemd-cgtop --dept=1 -b -n 10 -d 0.1 | cat

Assertion 'new_length >= 3' failed at src/shared/util.c:3 \
595, function ellipsize_mem(). Aborting.
Aborted (core dumped)

(David: add comment)

src/cgtop/cgtop.c

index 3c7ad40605a0e8ac83e2692b83eeed4c527089dc..f951c37cbcb4299330bc6790b17651923a9b82cf 100644 (file)
@@ -447,7 +447,7 @@ static int display(Hashmap *a) {
         Group *g;
         Group **array;
         signed path_columns;
-        unsigned rows, n = 0, j, maxtcpu = 0, maxtpath = 0;
+        unsigned rows, n = 0, j, maxtcpu = 0, maxtpath = 3; /* 3 for ellipsize() to work properly */
         char buffer[MAX3(21, FORMAT_BYTES_MAX, FORMAT_TIMESPAN_MAX)];
 
         assert(a);