summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-21 02:21:01 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-21 02:21:01 +0200
commit1db0db4b7f9c53f03efef2037ef6b0b384bfb248 (patch)
tree7b8be2abdf968cdab448fa8c458108ecec8ee3ce /src/core
parent2ab2ab7b19de7b4e1ef977a6c056ce0b525c198a (diff)
service: transition through SIGKILL states only when SIGKILL is enabled
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...
Diffstat (limited to 'src/core')
-rw-r--r--src/core/service.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 083c2eb444..201218e992 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -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);