From: Yu Watanabe Date: Fri, 8 Apr 2022 23:28:33 +0000 (+0900) Subject: sd-event: do not update signal fd after PID is changed X-Git-Tag: v251-rc2~133^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01e6af737494c9790edcc5521ea8c668565b797f;p=thirdparty%2Fsystemd.git sd-event: do not update signal fd after PID is changed Otherwise, child event source will not work after the process is forked and the event source is unref()ed on the child process. --- diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index e7c3fcd37c6..ca90890442e 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -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)