[systemd-commits] 2 commits - src/job.c src/service.c

Lennart Poettering lennart at kemper.freedesktop.org
Tue Jul 20 20:17:00 PDT 2010


 src/job.c     |    2 ++
 src/service.c |   31 ++++++++++++++++++++++++-------
 2 files changed, 26 insertions(+), 7 deletions(-)

New commits:
commit 3a2776bc8615eabefee8bd72d51b3c80519713c2
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 21 05:16:45 2010 +0200

    service: save/restore status text string

diff --git a/src/service.c b/src/service.c
index 978dca9..7fb3db3 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2000,6 +2000,9 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
 
         unit_serialize_item(u, f, "main-pid-known", yes_no(s->main_pid_known));
 
+        if (s->status_text)
+                unit_serialize_item(u, f, "status-text", s->status_text);
+
         /* There's a minor uncleanliness here: if there are multiple
          * commands attached here, we will start from the first one
          * again */
@@ -2084,6 +2087,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
                         log_debug("Failed to parse main-pid-known value %s", value);
                 else
                         s->main_pid_known = b;
+        } else if (streq(key, "status-text")) {
+                char *t;
+
+                if ((t = strdup(value))) {
+                        free(s->status_text);
+                        s->status_text = t;
+                }
+
         } else if (streq(key, "control-command")) {
                 ServiceExecCommand id;
 
@@ -2508,15 +2519,21 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
         if ((e = strv_find_prefix(tags, "STATUS="))) {
                 char *t;
 
-                if (!(t = strdup(e+7))) {
-                        log_error("Failed to allocate string.");
-                        return;
-                }
+                if (e[7]) {
+                        if (!(t = strdup(e+7))) {
+                                log_error("Failed to allocate string.");
+                                return;
+                        }
+
+                        log_debug("%s: got %s", u->meta.id, e);
 
-                log_debug("%s: got %s", u->meta.id, e);
+                        free(s->status_text);
+                        s->status_text = t;
+                } else {
+                        free(s->status_text);
+                        s->status_text = NULL;
+                }
 
-                free(s->status_text);
-                s->status_text = t;
         }
 }
 
commit cc42e0817ff82c5faa21678325b6683493b2e792
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 21 05:16:31 2010 +0200

    job: make sure restart jobs are readded to the run queue after conversion to start jobs

diff --git a/src/job.c b/src/job.c
index 2b422b4..d08bfe9 100644
--- a/src/job.c
+++ b/src/job.c
@@ -485,6 +485,8 @@ int job_finish_and_invalidate(Job *j, bool success) {
 
                 j->state = JOB_WAITING;
                 j->type = JOB_START;
+
+                job_add_to_run_queue(j);
                 return 0;
         }
 


More information about the systemd-commits mailing list