ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
65878a
From eb075b31eb70910508309c6319d0cc37d454ff59 Mon Sep 17 00:00:00 2001
65878a
From: Lennart Poettering <lennart@poettering.net>
65878a
Date: Mon, 7 Jul 2014 17:33:26 +0200
65878a
Subject: [PATCH] systemctl: show StatusErrno value in "systemctl status"
65878a
65878a
(cherry picked from commit b4af5a803aa71a57733ca46fef29b7afb20a626c)
65878a
65878a
Conflicts:
65878a
        src/systemctl/systemctl.c
65878a
65878a
Related: #1106457
65878a
---
65878a
 src/systemctl/systemctl.c | 5 +++++
65878a
 1 file changed, 5 insertions(+)
65878a
65878a
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
65878a
index d29133c..c738daf 100644
65878a
--- a/src/systemctl/systemctl.c
65878a
+++ b/src/systemctl/systemctl.c
65878a
@@ -2480,6 +2480,7 @@ typedef struct UnitStatusInfo {
65878a
         const char *status_text;
65878a
         const char *pid_file;
65878a
         bool running:1;
65878a
+        int status_errno;
65878a
 
65878a
         usec_t start_timestamp;
65878a
         usec_t exit_timestamp;
65878a
@@ -2751,6 +2752,8 @@ static void print_status_info(UnitStatusInfo *i,
65878a
 
65878a
         if (i->status_text)
65878a
                 printf("   Status: \"%s\"\n", i->status_text);
65878a
+        if (i->status_errno > 0)
65878a
+                printf("   Error: %i (%s)\n", i->status_errno, strerror(i->status_errno));
65878a
 
65878a
         if (i->control_group &&
65878a
             (i->main_pid > 0 || i->control_pid > 0 || cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, i->control_group, false) == 0)) {
65878a
@@ -2963,6 +2966,8 @@ static int status_property(const char *name, DBusMessageIter *iter, UnitStatusIn
65878a
                         i->exit_code = (int) j;
65878a
                 else if (streq(name, "ExecMainStatus"))
65878a
                         i->exit_status = (int) j;
65878a
+                else if (streq(name, "StatusErrno"))
65878a
+                        i->status_errno = (int) j;
65878a
 
65878a
                 break;
65878a
         }