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