chiark / gitweb /
unit: fix the race in deserialization.
[elogind.git] / src / cgtop / cgtop.c
index ee421e383b2eec9e2314a006d79daee71033a32a..f80d51efed60cfe31e56e8ed3b752188c83b5466 100644 (file)
@@ -31,6 +31,7 @@
 #include "hashmap.h"
 #include "cgroup-util.h"
 #include "build.h"
+#include "fileio.h"
 
 typedef struct Group {
         char *path;
@@ -443,9 +444,9 @@ 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() - 42;
         if (path_columns < 10)
@@ -653,7 +654,7 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
-        signal(SIGWINCH, columns_cache_reset);
+        signal(SIGWINCH, columns_lines_cache_reset);
 
         while (!quit) {
                 Hashmap *c;