core: disable the effect of Restart= if there's a stop job pending for a service...
authorLennart Poettering <lennart@poettering.net>
Sat, 26 Aug 2017 13:07:23 +0000 (15:07 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 26 Aug 2017 13:07:23 +0000 (22:07 +0900)
We shouldn't undo the job already enqueued, under any circumstances.

Fixes: #6504

src/core/service.c

index f43f13e..004e2a7 100644 (file)
@@ -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;