]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
service: better detect when a Type=notify service cannot become active anymore (...
authorJouke Witteveen <j.witteveen@gmail.com>
Mon, 2 Oct 2017 14:35:27 +0000 (16:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 2 Oct 2017 14:35:27 +0000 (16:35 +0200)
No need to wait for a timeout when we know things are not going to work out.
When the main process goes away and only notifications from the main process are
accepted, then we will not receive any notifications anymore.

src/core/service.c

index b34d7ddcb378ee55db28f2956f283ad32fb20d3f..e990d47797297ec6d6cc07aca4b592ce1abed10d 100644 (file)
@@ -3035,8 +3035,8 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                                          * has been received */
                                         if (f != SERVICE_SUCCESS)
                                                 service_enter_signal(s, SERVICE_STOP_SIGTERM, f);
-                                        else if (!s->remain_after_exit)
-                                                /* The service has never been active */
+                                        else if (!s->remain_after_exit || s->notify_access == NOTIFY_MAIN)
+                                                /* The service has never been and will never be active */
                                                 service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_PROTOCOL);
                                         break;
                                 }