1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 08:58:28 +02:00

Merge branch 'PHP-7.1'

This commit is contained in:
Nikita Popov
2016-12-29 21:18:58 +01:00
2 changed files with 36 additions and 4 deletions
+8 -4
View File
@@ -198,7 +198,7 @@ static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context)
#endif
}
}
} else if (p_sig.handler != SIG_IGN) { /* ignore SIG_IGN */
} else {
if (p_sig.flags & SA_SIGINFO) {
if (p_sig.flags & SA_RESETHAND) {
SIGG(handlers)[signo-1].flags = 0;
@@ -234,9 +234,13 @@ ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigac
}
memset(&sa, 0, sizeof(sa));
sa.sa_flags = SA_SIGINFO | (act->sa_flags & SA_FLAGS_MASK);
sa.sa_sigaction = zend_signal_handler_defer;
sa.sa_mask = global_sigmask;
if (SIGG(handlers)[signo-1].handler == (void *) SIG_IGN) {
sa.sa_sigaction = (void *) SIG_IGN;
} else {
sa.sa_flags = SA_SIGINFO | (act->sa_flags & SA_FLAGS_MASK);
sa.sa_sigaction = zend_signal_handler_defer;
sa.sa_mask = global_sigmask;
}
if (sigaction(signo, &sa, NULL) < 0) {
zend_error_noreturn(E_ERROR, "Error installing signal handler for %d", signo);
+28
View File
@@ -0,0 +1,28 @@
--TEST--
Bug #73783: (SIG_IGN needs to be set to prevent syscals from returning early)
--SKIPIF--
<?php
if (!extension_loaded('pcntl')) die('skip pcntl extension not available');
elseif (!extension_loaded('posix')) die('skip posix extension not available');
?>
--FILE--
<?php
pcntl_signal(SIGCHLD, SIG_IGN);
switch(pcntl_fork()) {
case 0:
exit;
break;
}
$before = microtime(true);
sleep(1);
if (microtime(true) - $before >= 0.8) {
echo "working\n";
} else {
echo "failed\n";
}
?>
--EXPECTF--
working