99043cc
From 15a0e7e31600299fa9ba076d58704116c95a8226 Mon Sep 17 00:00:00 2001
99043cc
From: Shawn Landden <shawnlandden@gmail.com>
99043cc
Date: Mon, 21 May 2012 22:54:41 -0700
99043cc
Subject: [PATCH] cgtop: work even if not all cgroups are available
99043cc
99043cc
cgtop quits on startup if all the cgroup mounts it expects are not available.
99043cc
Just continue without nonexistant ones.
99043cc
(cherry picked from commit 63210a15e1efdbda3fb3abd9a6ae9961fd0ea153)
99043cc
---
99043cc
 src/cgtop/cgtop.c |   17 +++++++++++------
99043cc
 1 file changed, 11 insertions(+), 6 deletions(-)
99043cc
99043cc
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
99043cc
index b8cf3b7..a44e59f 100644
99043cc
--- a/src/cgtop/cgtop.c
99043cc
+++ b/src/cgtop/cgtop.c
99043cc
@@ -341,17 +341,22 @@ static int refresh(Hashmap *a, Hashmap *b, unsigned iteration) {
99043cc
 
99043cc
         r = refresh_one("name=systemd", "/", a, b, iteration, 0);
99043cc
         if (r < 0)
99043cc
-                return r;
99043cc
-
99043cc
+                if (r != -ENOENT)
99043cc
+                    return r;
99043cc
         r = refresh_one("cpuacct", "/", a, b, iteration, 0);
99043cc
         if (r < 0)
99043cc
-                return r;
99043cc
-
99043cc
+                if (r != -ENOENT)
99043cc
+                    return r;
99043cc
         r = refresh_one("memory", "/", a, b, iteration, 0);
99043cc
         if (r < 0)
99043cc
-                return r;
99043cc
+                if (r != -ENOENT)
99043cc
+                    return r;
99043cc
 
99043cc
-        return refresh_one("blkio", "/", a, b, iteration, 0);
99043cc
+        r = refresh_one("blkio", "/", a, b, iteration, 0);
99043cc
+        if (r < 0)
99043cc
+                if (r != -ENOENT)
99043cc
+                    return r;
99043cc
+        return 0;
99043cc
 }
99043cc
 
99043cc
 static int group_compare(const void*a, const void *b) {