]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
socket-activate: Always send NOTIFY=ready
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Thu, 3 Jul 2025 08:41:50 +0000 (10:41 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 10 Jul 2025 14:19:46 +0000 (16:19 +0200)
Even if we're not using --accept=, it's very useful to be able to
synchronize on systemd-socket-activate having binded to its listen
socket, so let's always send READY=1. This means the payload can't
send READY=1 anymore but it's doubtful whether that's useful in this
case in the first place.

src/socket-activate/socket-activate.c

index d4b584e4d3827ba9016dfb6e3c7b139f38a115f3..8e5dfb41d4bf61a63854757fa968199a302ccffe 100644 (file)
@@ -494,18 +494,15 @@ static int run(int argc, char **argv) {
         if (n == 0)
                 return log_error_errno(SYNTHETIC_ERRNO(ENOENT), "No sockets to listen on specified or passed in.");
 
-        /* Notify the caller that all sockets are open now. We only do this in --accept mode however,
-         * since otherwise our process will be replaced and it's better to leave the readiness notify
-         * to the actual payload. */
-        _unused_ _cleanup_(notify_on_cleanup) const char *notify = NULL;
         if (arg_accept) {
                 r = install_chld_handler();
                 if (r < 0)
                         return r;
-
-                notify = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
         }
 
+        /* Notify the caller that all sockets are open now. */
+        _unused_ _cleanup_(notify_on_cleanup) const char *notify = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
+
         for (;;) {
                 struct epoll_event event;