chiark / gitweb /
honor SELinux labels, when creating and writing config files
[elogind.git] / src / cgtop / cgtop.c
index 3756328fa7b7df80b93dd2cac249efb597c7712d..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;
@@ -300,7 +301,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 +444,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 +654,8 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
+        signal(SIGWINCH, columns_lines_cache_reset);
+
         while (!quit) {
                 Hashmap *c;
                 usec_t t;