]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: consider service with no start command immediately started
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 16 Oct 2018 20:45:34 +0000 (22:45 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 17 Oct 2018 17:28:16 +0000 (19:28 +0200)
The service would always be in state == SERVICE_INACTIVE, but it needs to go
through state == SERVICE_START so that SuccessAction/FailureAction are executed.

src/core/service.c

index 3d065bf487ce9821faf1618adf629d8323b138c0..5472e1a908db79968a63626be055634766552269 100644 (file)
@@ -2024,6 +2024,12 @@ static void service_enter_start(Service *s) {
                         goto fail;
                 }
 
+                /* We force a fake state transition here. Otherwise, the unit would go directly from
+                 * SERVICE_DEAD to SERVICE_DEAD without SERVICE_ACTIVATING or SERVICE_ACTIVE
+                 * inbetween. This way we can later trigger actions that depend on the state
+                 * transition, including SuccessAction=. */
+                service_set_state(s, SERVICE_START);
+
                 service_enter_start_post(s);
                 return;
         }