]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coredumpctl: add debug information which services count towards the warning
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 25 Feb 2017 22:14:00 +0000 (17:14 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 27 Feb 2017 00:45:10 +0000 (19:45 -0500)
A few times I have seen the hint unexpectedly. Add this so debug info
so it's easier to see what's happening.

...
Unit systemd-coredump@0-3119-0.service is failed/failed, not counting it.
Unit systemd-coredump@1-3854-0.service is activating/start-pre, counting it.
...
-- Notice: 1 systemd-coredump@.service unit is running, output may be incomplete.

src/coredump/coredumpctl.c

index 4ac98d8163d5fd2aa3ea3682ca63b513990755ee..810d4f95a4efff25b7e40d5916d764381d339b5b 100644 (file)
@@ -936,7 +936,7 @@ static int check_units_active(void) {
         _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
         _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
         int c = 0, r;
-        const char *state;
+        const char *id, *state, *substate;
 
         r = sd_bus_default_system(&bus);
         if (r < 0)
@@ -971,11 +971,12 @@ static int check_units_active(void) {
 
         while ((r = sd_bus_message_read(
                                 reply, "(ssssssouso)",
-                                NULL,  NULL,  NULL,  &state,  NULL,
-                                NULL,  NULL,  NULL,  NULL,  NULL)) > 0)
-                if (!STR_IN_SET(state, "dead", "failed"))
-                        c++;
-
+                                &id,  NULL,  NULL,  &state,  &substate,
+                                NULL,  NULL,  NULL,  NULL,  NULL)) > 0) {
+                bool found = !STR_IN_SET(state, "dead", "failed");
+                log_debug("Unit %s is %s/%s, %scounting it.", id, state, substate, found ? "" : "not ");
+                c += found;
+        }
         if (r < 0)
                 return bus_log_parse_error(r);