From 4cd9fa8176aa8e291cc5f169fd26752850b124dd Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 14 Aug 2017 11:15:38 +0100 Subject: [PATCH] core: failure to spawn ExecStartPost should not run ExecStop Failure to spawn ExecStartPost was being handled differently to e.g. EXIT_FAILURE returned by ExecStartPost. It looks like this was an oversight. Fix to match documented behaviour. `man systemd.service`: > Note that if any of the commands specified in ExecStartPre=, ExecStart=, > or ExecStartPost= fail (and are not prefixed with "-", see above) or time > out before the service is fully up, execution continues with commands > specified in ExecStopPost=, the commands in ExecStop= are skipped. --- src/core/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/service.c b/src/core/service.c index 915943aff3a..78f315ad186 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2087,7 +2087,7 @@ static void service_run_next_control(Service *s) { fail: log_unit_warning_errno(UNIT(s), r, "Failed to run next control task: %m"); - if (IN_SET(s->state, SERVICE_START_PRE, SERVICE_STOP)) + if (IN_SET(s->state, SERVICE_START_PRE, SERVICE_START_POST, SERVICE_STOP)) service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_RESOURCES); else if (s->state == SERVICE_STOP_POST) service_enter_dead(s, SERVICE_FAILURE_RESOURCES, true);