From ac84d1fb5a7293df4f75544eedf148ba0bb4ec21 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 29 Jan 2014 14:58:04 +0100 Subject: core: make sure to always go through both SIGTERM and SIGKILL states of units Given that we now have KillMode=mixed where SIGTERM might kill a smaller set than SIGKILL we need to make sure to always go explicitly throught the SIGKILL state to get the right end result. --- src/core/service.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/core/service.c') diff --git a/src/core/service.c b/src/core/service.c index 1ec2e51fc2..0542eae023 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1913,10 +1913,9 @@ static void service_enter_stop_post(Service *s, ServiceResult f) { if (r < 0) goto fail; - service_set_state(s, SERVICE_STOP_POST); } else - service_enter_dead(s, SERVICE_SUCCESS, true); + service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_SUCCESS); return; @@ -1942,6 +1941,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f s->main_pid, s->control_pid, s->main_pid_alien); + if (r < 0) goto fail; @@ -1953,8 +1953,12 @@ 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_SIGKILL) + } else if (state == SERVICE_STOP_SIGTERM) + service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_SUCCESS); + else if (state == SERVICE_STOP_SIGKILL) service_enter_stop_post(s, SERVICE_SUCCESS); + else if (state == SERVICE_FINAL_SIGTERM) + service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_SUCCESS); else service_enter_dead(s, SERVICE_SUCCESS, true); -- cgit v1.2.3-54-g00ecf