]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: forbid reverting STOPPING=1
authorMike Yuan <me@yhndnzj.com>
Sun, 19 Oct 2025 19:35:52 +0000 (21:35 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 4 Nov 2025 11:17:32 +0000 (12:17 +0100)
We don't permit state transition from STOPPING back to RUNNING,
hence refrain from resetting notify_state too.

src/core/service.c

index 3722cc5e663b05197ca1c52190463bb6a3a3ae1c..bfd6022e0e9697c0c0237d81f264520961a86df9 100644 (file)
@@ -4769,7 +4769,14 @@ static void service_notify_message_process_state(Service *s, char * const *tags)
                 if (IN_SET(s->state, SERVICE_RUNNING, SERVICE_RELOAD_SIGNAL, SERVICE_RELOAD_NOTIFY, SERVICE_REFRESH_EXTENSIONS))
                         service_enter_stop_by_notify(s);
 
-        } else if (strv_contains(tags, "READY=1")) {
+                return;
+        }
+
+        /* Disallow resurrecting a dying service */
+        if (s->notify_state == NOTIFY_STOPPING)
+                return;
+
+        if (strv_contains(tags, "READY=1")) {
 
                 s->notify_state = NOTIFY_READY;