chiark / gitweb /
cgtop: fix assert when not on tty
[elogind.git] / src / cgtop / cgtop.c
index 932a7ba7c6c360c8bf5d1c2ad8842d7f47e0c21b..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);
@@ -748,7 +748,7 @@ int main(int argc, char *argv[]) {
                         if (r == -ETIMEDOUT)
                                 continue;
                         if (r < 0) {
-                                log_error("Couldn't read key: %s", strerror(-r));
+                                log_error_errno(r, "Couldn't read key: %m");
                                 goto finish;
                         }
                 }
@@ -842,7 +842,7 @@ finish:
         group_hashmap_free(b);
 
         if (r < 0) {
-                log_error("Exiting with failure: %s", strerror(-r));
+                log_error_errno(r, "Exiting with failure: %m");
                 return EXIT_FAILURE;
         }