]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: Type=notify/dbus services shouldn't be considered active
authorMike Yuan <me@yhndnzj.com>
Sat, 2 Mar 2024 13:03:22 +0000 (21:03 +0800)
committerMike Yuan <me@yhndnzj.com>
Tue, 5 Mar 2024 02:45:49 +0000 (10:45 +0800)
when ExitType=cgroup and main process exits

Follow-up for ef4300654e70e76ed74f7d544e0f44c5d92fb698

src/core/service.c

index f11ef0859a6b3c3918928dacec23826b433cbb66..a2a8e4af697ba0aaa11172ad13679b9846770338 100644 (file)
@@ -3877,11 +3877,13 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                                 default:
                                         assert_not_reached();
                                 }
-                        } else if (s->exit_type == SERVICE_EXIT_CGROUP && s->state == SERVICE_START)
+                        } else if (s->exit_type == SERVICE_EXIT_CGROUP && s->state == SERVICE_START &&
+                                   !IN_SET(s->type, SERVICE_NOTIFY, SERVICE_NOTIFY_RELOAD, SERVICE_DBUS))
                                 /* If a main process exits very quickly, this function might be executed
                                  * before service_dispatch_exec_io(). Since this function disabled IO events
                                  * to monitor the main process above, we need to update the state here too.
-                                 * Let's consider the process is successfully launched and exited. */
+                                 * Let's consider the process is successfully launched and exited, but
+                                 * only when we're not expecting a readiness notification or dbus name. */
                                 service_enter_start_post(s);
                 }