fb7efbf
From 9a73a3023c5934c88ba1da694c41af4e1c08ff44 Mon Sep 17 00:00:00 2001
fb7efbf
From: Lennart Poettering <lennart@poettering.net>
fb7efbf
Date: Mon, 24 Aug 2015 21:09:49 +0200
fb7efbf
Subject: [PATCH 36/47] systemctl: properly handle empty control group paths in
fb7efbf
 "status"
fb7efbf
fb7efbf
When showing the status of the "-.slice" slice root unit (whose reported
fb7efbf
cgroup path is ""), we suppressed the cgroup tree so far, because
fb7efbf
skipped it for all unit with an empty cgroup path. Let's fix that, and
fb7efbf
properly handle the empty cgroup path.
fb7efbf
---
fb7efbf
 src/systemctl/systemctl.c | 11 ++++++++---
fb7efbf
 1 file changed, 8 insertions(+), 3 deletions(-)
fb7efbf
fb7efbf
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
fb7efbf
index 6db4d65..3ee8f20 100644
fb7efbf
--- a/src/systemctl/systemctl.c
fb7efbf
+++ b/src/systemctl/systemctl.c
fb7efbf
@@ -3609,7 +3609,14 @@ static int status_property(const char *name, sd_bus_message *m, UnitStatusInfo *
fb7efbf
                 if (r < 0)
fb7efbf
                         return bus_log_parse_error(r);
fb7efbf
 
fb7efbf
-                if (!isempty(s)) {
fb7efbf
+                if (streq(name, "ControlGroup"))
fb7efbf
+                        i->control_group = s;
fb7efbf
+                else if (!isempty(s)) {
fb7efbf
+                        /* For all but the cgroup path (see above) we
fb7efbf
+                         * consider the empty string as unset. For the
fb7efbf
+                         * cgroup path the empty string refers to the
fb7efbf
+                         * root of the cgroup tree. */
fb7efbf
+
fb7efbf
                         if (streq(name, "Id"))
fb7efbf
                                 i->id = s;
fb7efbf
                         else if (streq(name, "LoadState"))
fb7efbf
@@ -3632,8 +3639,6 @@ static int status_property(const char *name, sd_bus_message *m, UnitStatusInfo *
fb7efbf
                                         i->control_group = e;
fb7efbf
                         }
fb7efbf
 #endif
fb7efbf
-                        else if (streq(name, "ControlGroup"))
fb7efbf
-                                i->control_group = s;
fb7efbf
                         else if (streq(name, "StatusText"))
fb7efbf
                                 i->status_text = s;
fb7efbf
                         else if (streq(name, "PIDFile"))
fb7efbf
-- 
fb7efbf
2.5.0
fb7efbf