sd-event: do not update signal fd after PID is changed
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 8 Apr 2022 23:28:33 +0000 (08:28 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 28 Apr 2022 17:17:59 +0000 (19:17 +0200)
Otherwise, child event source will not work after the process is forked
and the event source is unref()ed on the child process.

(cherry picked from commit 01e6af737494c9790edcc5521ea8c668565b797f)
(cherry picked from commit c36ab05b4f5b196091a2e1518f19e5800897e576)

src/libsystemd/sd-event/sd-event.c

index a82f79fd28717c11036388575786eccfdcb591a6..7d9af1ff81965b134e70026bc108d295945bb5d0 100644 (file)
@@ -706,6 +706,9 @@ static void event_unmask_signal_data(sd_event *e, struct signal_data *d, int sig
                 return;
         }
 
+        if (event_pid_changed(e))
+                return;
+
         assert(d->fd >= 0);
 
         if (signalfd(d->fd, &d->sigset, SFD_NONBLOCK|SFD_CLOEXEC) < 0)