summaryrefslogtreecommitdiff
path: root/src/core/service.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-29 14:58:04 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-29 17:46:47 +0100
commitac84d1fb5a7293df4f75544eedf148ba0bb4ec21 (patch)
treeeec35601f6ce583520e3a41076023624ed183160 /src/core/service.c
parentc9cf047362cd8e4530c10bc7c2d6db988452305d (diff)
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.
Diffstat (limited to 'src/core/service.c')
-rw-r--r--src/core/service.c10
1 files changed, 7 insertions, 3 deletions
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);