summaryrefslogtreecommitdiff
path: root/src/cgtop/cgtop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgtop/cgtop.c')
-rw-r--r--src/cgtop/cgtop.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index a57a468b2c..f2e62761f1 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -300,7 +300,7 @@ static int refresh_one(
r = cg_enumerate_subgroups(controller, path, &d);
if (r < 0) {
- if (r == ENOENT)
+ if (r == -ENOENT)
return 0;
return r;
@@ -443,11 +443,11 @@ static int display(Hashmap *a) {
qsort(array, n, sizeof(Group*), group_compare);
- rows = fd_lines(STDOUT_FILENO);
- if (rows <= 0)
- rows = 25;
+ rows = lines();
+ if (rows <= 10)
+ rows = 10;
- path_columns = columns_uncached() - 42;
+ path_columns = columns() - 42;
if (path_columns < 10)
path_columns = 10;
@@ -653,6 +653,8 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ signal(SIGWINCH, columns_lines_cache_reset);
+
while (!quit) {
Hashmap *c;
usec_t t;
@@ -782,5 +784,10 @@ finish:
group_hashmap_free(a);
group_hashmap_free(b);
- return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+ if (r < 0) {
+ log_error("Exiting with failure: %s", strerror(-r));
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
}