]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
service: transition through SIGKILL states only when SIGKILL is enabled
authorLennart Poettering <lennart@poettering.net>
Tue, 21 Apr 2015 00:21:01 +0000 (02:21 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 21 Apr 2015 00:21:01 +0000 (02:21 +0200)
If there's no remaining process to kill, skip the SIGKILL states if
SIGKILL is disabled.

Effectively this doesn't change much since if there's nothing to kill
with SIGTERM or SIGABRT then there's also nothing to kill with SIGKILL.
However, this avoids confusion with the state engine jumping through
SIGKILL states for no reason...

src/core/service.c

index 083c2eb4440a697c90a38b66c8a7432d97a99749..201218e992819d4610305dfb4de81a237c8d66d2 100644 (file)
@@ -1409,11 +1409,11 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
                 }
 
                 service_set_state(s, state);
-        } else if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGABRT)
+        } else if (IN_SET(state, SERVICE_STOP_SIGABRT, SERVICE_STOP_SIGTERM) && s->kill_context.send_sigkill)
                 service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_SUCCESS);
-        else if (state == SERVICE_STOP_SIGKILL)
+        else if (IN_SET(state, SERVICE_STOP_SIGABRT, SERVICE_STOP_SIGTERM, SERVICE_STOP_SIGKILL))
                 service_enter_stop_post(s, SERVICE_SUCCESS);
-        else if (state == SERVICE_FINAL_SIGTERM)
+        else if (state == SERVICE_FINAL_SIGTERM && s->kill_context.send_sigkill)
                 service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_SUCCESS);
         else
                 service_enter_dead(s, SERVICE_SUCCESS, true);