diff --git a/src/core/service.c b/src/core/service.c index f43f13e927..004e2a7358 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1498,8 +1498,14 @@ static bool service_will_restart(Service *s) { static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart) { int r; + assert(s); + /* If there's a stop job queued before we enter the DEAD state, we shouldn't act on Restart=, in order to not + * undo what has already been enqueued. */ + if (unit_stop_pending(UNIT(s))) + allow_restart = false; + if (s->result == SERVICE_SUCCESS) s->result = f;