valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0092-cgtop-fix-assert-when-not-on-tty.patch

1ff636
From 33088d83ecaf03611e3d20a893e675e4d7c3ae9a Mon Sep 17 00:00:00 2001
1ff636
From: Umut Tezduyar Lindskog <umut.tezduyar@axis.com>
1ff636
Date: Wed, 11 Mar 2015 11:24:18 +0100
1ff636
Subject: [PATCH] cgtop: fix assert when not on tty
1ff636
1ff636
systemd-cgtop --dept=1 -b -n 10 -d 0.1 | cat
1ff636
1ff636
Assertion 'new_length >= 3' failed at src/shared/util.c:3 \
1ff636
595, function ellipsize_mem(). Aborting.
1ff636
Aborted (core dumped)
1ff636
1ff636
(David: add comment)
1ff636
1ff636
(cherry picked from commit 510c4a0f1e7e7efe2897d2fbb9067f121467b103)
1ff636
---
1ff636
 src/cgtop/cgtop.c | 2 +-
1ff636
 1 file changed, 1 insertion(+), 1 deletion(-)
1ff636
1ff636
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
181b3f
index 3c7ad4060..f951c37cb 100644
1ff636
--- a/src/cgtop/cgtop.c
1ff636
+++ b/src/cgtop/cgtop.c
1ff636
@@ -447,7 +447,7 @@ static int display(Hashmap *a) {
1ff636
         Group *g;
1ff636
         Group **array;
1ff636
         signed path_columns;
1ff636
-        unsigned rows, n = 0, j, maxtcpu = 0, maxtpath = 0;
1ff636
+        unsigned rows, n = 0, j, maxtcpu = 0, maxtpath = 3; /* 3 for ellipsize() to work properly */
1ff636
         char buffer[MAX3(21, FORMAT_BYTES_MAX, FORMAT_TIMESPAN_MAX)];
1ff636
 
1ff636
         assert(a);