summaryrefslogtreecommitdiff
path: root/ext/pcntl/php_signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pcntl/php_signal.c')
-rw-r--r--ext/pcntl/php_signal.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index 8f1b350016..7ef2cb4b38 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2017 The PHP Group |
+ | Copyright (c) 1997-2018 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -28,15 +28,21 @@
Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
{
struct sigaction act,oact;
-#ifdef ZEND_SIGNALS
-#endif
+
+#ifdef HAVE_STRUCT_SIGINFO_T
+ act.sa_sigaction = func;
+#else
act.sa_handler = func;
+#endif
if (mask_all) {
sigfillset(&act.sa_mask);
} else {
sigemptyset(&act.sa_mask);
}
act.sa_flags = 0;
+#ifdef HAVE_STRUCT_SIGINFO_T
+ act.sa_flags |= SA_SIGINFO;
+#endif
if (signo == SIGALRM || (! restart)) {
#ifdef SA_INTERRUPT
act.sa_flags |= SA_INTERRUPT; /* SunOS */
@@ -46,16 +52,15 @@ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
#endif
}
-#ifdef ZEND_SIGNALS
- if (zend_sigaction(signo, &act, &oact) < 0)
-#else
- if (sigaction(signo, &act, &oact) < 0)
-#endif
- {
- return SIG_ERR;
+ if (zend_sigaction(signo, &act, &oact) < 0) {
+ return (Sigfunc*)SIG_ERR;
}
+#ifdef HAVE_STRUCT_SIGINFO_T
+ return oact.sa_sigaction;
+#else
return oact.sa_handler;
+#endif
}
Sigfunc *php_signal(int signo, Sigfunc *func, int restart)