You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FixGH-11498: SIGCHLD is not always returned from proc_open
Linux, and maybe other unixes, may merge multiple standard signals into
a single one. This causes issues when keeping track of process IDs.
Solve this by manually checking which children are dead using waitpid().
Test case is based on taka-oyama's test code.
ClosesGH-11509.
/* oops, too many signals for us to track, so we'll forget about this one */
1346
1346
return;
1347
1347
}
1348
-
PCNTL_G(spares) =psig->next;
1349
1348
1350
-
psig->signo=signo;
1351
-
psig->next=NULL;
1349
+
structphp_pcntl_pending_signal*psig_first=psig;
1350
+
1351
+
/* Standard signals may be merged into a single one.
1352
+
* POSIX specifies that SIGCHLD has the si_pid field (https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html),
1353
+
* so we'll handle the merging for that signal.
1354
+
* See also: https://www.gnu.org/software/libc/manual/html_node/Merged-Signals.html */
1355
+
if (signo==SIGCHLD) {
1356
+
/* Note: The first waitpid result is not necessarily the pid that was passed above!
1357
+
* We therefore cannot avoid the first waitpid() call. */
1358
+
intstatus;
1359
+
pid_tpid;
1360
+
while (true) {
1361
+
do {
1362
+
errno=0;
1363
+
/* Although Linux specifies that WNOHANG will never result in EINTR, POSIX doesn't say so:
0 commit comments