chiark / gitweb /
udev: avoid building selinux parts without have_selinux
[elogind.git] / src / service.c
index babd9cf9a550b4892413855ef22d75d20876218c..bf2e0a9d98f99979b8881f6209a20f3727635b72 100644 (file)
@@ -39,6 +39,7 @@
 #include "exit-status.h"
 #include "def.h"
 #include "util.h"
+#include "utf8.h"
 
 #ifdef HAVE_SYSV_COMPAT
 
@@ -2207,9 +2208,12 @@ static void service_enter_restart(Service *s) {
                         goto fail;
         }
 
-        service_enter_dead(s, SERVICE_SUCCESS, false);
-
-        if ((r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT(s), JOB_FAIL, false, &error, NULL)) < 0)
+        /* Any units that are bound to this service must also be
+         * restarted. We use JOB_RESTART (instead of the more obvious
+         * JOB_START) here so that those dependency jobs will be added
+         * as well. */
+        r = manager_add_job(UNIT(s)->manager, JOB_RESTART, UNIT(s), JOB_FAIL, false, &error, NULL);
+        if (r < 0)
                 goto fail;
 
         log_debug("%s scheduled restart job.", UNIT(s)->id);
@@ -3200,11 +3204,19 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
         }
 
         /* Interpret STATUS= */
-        if ((e = strv_find_prefix(tags, "STATUS="))) {
+        e = strv_find_prefix(tags, "STATUS=");
+        if (e) {
                 char *t;
 
                 if (e[7]) {
-                        if (!(t = strdup(e+7))) {
+
+                        if (!utf8_is_valid(e+7)) {
+                                log_warning("Status message in notification is not UTF-8 clean.");
+                                return;
+                        }
+
+                        t = strdup(e+7);
+                        if (!t) {
                                 log_error("Failed to allocate string.");
                                 return;
                         }