chiark / gitweb /
unit: split unit_printf() and friends into its own .c file
[elogind.git] / src / core / service.c
index 807b34267f19622eaf984a82acd3a5abc4e7e6b4..1e3e875c3fd36dde473baeef694733184537cb33 100644 (file)
@@ -33,6 +33,7 @@
 #include "log.h"
 #include "strv.h"
 #include "unit-name.h"
+#include "unit-printf.h"
 #include "dbus-service.h"
 #include "special.h"
 #include "bus-errors.h"
@@ -932,7 +933,6 @@ static int service_load_sysv_path(Service *s, const char *path) {
                 s->timeout_stop_usec = DEFAULT_SYSV_TIMEOUT_USEC;
         }
 
-
         /* Special setting for all SysV services */
         s->type = SERVICE_FORKING;
         s->remain_after_exit = !s->pid_file;
@@ -2961,12 +2961,10 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                                         else
                                                 service_enter_signal(s, SERVICE_FINAL_SIGTERM, f);
                                         break;
-                                } else {
-                                        assert(s->type == SERVICE_DBUS || s->type == SERVICE_NOTIFY);
-
-                                        /* Fall through */
                                 }
 
+                                /* Fall through */
+
                         case SERVICE_RUNNING:
                                 service_enter_running(s, f);
                                 break;
@@ -3036,7 +3034,9 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                                 break;
 
                         case SERVICE_START:
-                                assert(s->type == SERVICE_FORKING);
+                                if (s->type != SERVICE_FORKING)
+                                        /* Maybe spurious event due to a reload that changed the type? */
+                                        break;
 
                                 if (f != SERVICE_SUCCESS) {
                                         service_enter_signal(s, SERVICE_FINAL_SIGTERM, f);