chiark / gitweb /
service: fix segfault
[elogind.git] / service.c
index 21e8436661523a8605d78fa4727e1ff29c01d6f6..0a70bb0a7c518168c6d7d01375b0930c10fe34e9 100644 (file)
--- a/service.c
+++ b/service.c
@@ -623,6 +623,10 @@ static int service_load_sysv_path(Service *s, const char *path) {
         /* Special setting for all SysV services */
         s->valid_no_process = true;
 
+        /* Don't timeout special services during boot (like fsck) */
+        if (s->sysv_runlevels && !chars_intersect("12345", s->sysv_runlevels))
+                s->timeout_usec = -1;
+
         u->meta.load_state = UNIT_LOADED;
         r = 0;
 
@@ -1461,11 +1465,12 @@ static void service_enter_restart(Service *s) {
         int r;
         assert(s);
 
+        service_enter_dead(s, true, false);
+
         if ((r = manager_add_job(UNIT(s)->meta.manager, JOB_START, UNIT(s), JOB_FAIL, false, NULL)) < 0)
                 goto fail;
 
         log_debug("%s scheduled restart job.", unit_id(UNIT(s)));
-        service_enter_dead(s, true, false);
         return;
 
 fail: