]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 12 Apr 2022 16:00:08 +0000 (01:00 +0900)
Otherwise, child event source will not work after the process is forked
and the event source is unref()ed on the child process.

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

index e7c3fcd37c66051e79c4a2201c8614ff3e8ebb81..ca90890442ec05918e044cee3fe42b9ee0e06529 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)