[systemd-commits] 3 commits - src/core src/systemctl

Lennart Poettering lennart at kemper.freedesktop.org
Mon Jul 7 08:34:27 PDT 2014


 src/core/service.c        |    6 +++++-
 src/systemctl/systemctl.c |    5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 8cfdb077b8e3da1c47fc1d735d051f21f33144c1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Jul 7 17:33:46 2014 +0200

    service: flush status text and errno values each time a service is started
    
    We shouldn't show status texts from previous service starts

diff --git a/src/core/service.c b/src/core/service.c
index d5aff99..0f542ed 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1699,6 +1699,10 @@ static int service_start(Unit *u) {
         s->main_pid_alien = false;
         s->forbid_restart = false;
 
+        free(s->status_text);
+        s->status_text = NULL;
+        s->status_errno = 0;
+
         service_enter_start_pre(s);
         return 0;
 }

commit b4af5a803aa71a57733ca46fef29b7afb20a626c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Jul 7 17:33:26 2014 +0200

    systemctl: show StatusErrno value in "systemctl status"

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 03720f4..1ab4794 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -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;
         }

commit 2040ccf171404b709acb0ecf1d1f17b87c5d05f0
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Jul 7 17:32:44 2014 +0200

    service: don't accept negative ERRNO= notification messages

diff --git a/src/core/service.c b/src/core/service.c
index 5c54a34..d5aff99 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2637,7 +2637,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
         if (e) {
                 int status_errno;
 
-                if (safe_atoi(e + 6, &status_errno) < 0)
+                if (safe_atoi(e + 6, &status_errno) < 0 || status_errno < 0)
                         log_warning_unit(u->id, "Failed to parse ERRNO= field in notification message: %s", e);
                 else {
                         log_debug_unit(u->id, "%s: got %s", u->id, e);



More information about the systemd-commits mailing list