chiark / gitweb /
systemctl: show StatusErrno value in "systemctl status"
authorLennart Poettering <lennart@poettering.net>
Mon, 7 Jul 2014 15:33:26 +0000 (17:33 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 7 Jul 2014 15:33:26 +0000 (17:33 +0200)
src/systemctl/systemctl.c

index 03720f4..1ab4794 100644 (file)
@@ -3170,6 +3170,7 @@ typedef struct UnitStatusInfo {
         const char *status_text;
         const char *pid_file;
         bool running:1;
+        int status_errno;
 
         usec_t start_timestamp;
         usec_t exit_timestamp;
@@ -3441,6 +3442,8 @@ static void print_status_info(
 
         if (i->status_text)
                 printf("   Status: \"%s\"\n", i->status_text);
+        if (i->status_errno > 0)
+                printf("    Error: %i (%s)\n", i->status_errno, strerror(i->status_errno));
 
         if (i->control_group &&
             (i->main_pid > 0 || i->control_pid > 0 ||
@@ -3661,6 +3664,8 @@ static int status_property(const char *name, sd_bus_message *m, UnitStatusInfo *
                         i->exit_code = (int) j;
                 else if (streq(name, "ExecMainStatus"))
                         i->exit_status = (int) j;
+                else if (streq(name, "StatusErrno"))
+                        i->status_errno = (int) j;
 
                 break;
         }