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