]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: properly handle empty control group paths in "status"
authorLennart Poettering <lennart@poettering.net>
Mon, 24 Aug 2015 19:09:49 +0000 (21:09 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 24 Aug 2015 20:46:45 +0000 (22:46 +0200)
When showing the status of the "-.slice" slice root unit (whose reported
cgroup path is ""), we suppressed the cgroup tree so far, because
skipped it for all unit with an empty cgroup path. Let's fix that, and
properly handle the empty cgroup path.

src/systemctl/systemctl.c

index 1a9dbadbe143c8c3a07e202b1f40014d5787e395..3cd267ec5a83f0b5fa6979f367aca356c3480b66 100644 (file)
@@ -3608,7 +3608,14 @@ static int status_property(const char *name, sd_bus_message *m, UnitStatusInfo *
                 if (r < 0)
                         return bus_log_parse_error(r);
 
-                if (!isempty(s)) {
+                if (streq(name, "ControlGroup"))
+                        i->control_group = s;
+                else if (!isempty(s)) {
+                        /* For all but the cgroup path (see above) we
+                         * consider the empty string as unset. For the
+                         * cgroup path the empty string refers to the
+                         * root of the cgroup tree. */
+
                         if (streq(name, "Id"))
                                 i->id = s;
                         else if (streq(name, "LoadState"))
@@ -3631,8 +3638,6 @@ static int status_property(const char *name, sd_bus_message *m, UnitStatusInfo *
                                         i->control_group = e;
                         }
 #endif
-                        else if (streq(name, "ControlGroup"))
-                                i->control_group = s;
                         else if (streq(name, "StatusText"))
                                 i->status_text = s;
                         else if (streq(name, "PIDFile"))