summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2018-02-28 02:13:28 +0100
committerBob Weinand <bobwei9@hotmail.com>2018-02-28 02:13:28 +0100
commit3f32bd9f43db581fe1aa8132e13a98e159bd8489 (patch)
treea66b842835742c03896a8ab4dcadf72a9187f8c8
parentb53e547d85d1f58752630d0f40cfd44aa66007b5 (diff)
downloadphp-git-3f32bd9f43db581fe1aa8132e13a98e159bd8489.tar.gz
Fix pcntl build on mac
Apparently on mac WIF*(x) macros resolve to (*(int*)&x) (_W_INT macro in sys/wait.h), forcing the value to be a lvalue
-rw-r--r--ext/pcntl/pcntl.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 886099c573..0884aac616 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -756,12 +756,14 @@ PHP_FUNCTION(pcntl_wifexited)
{
#ifdef WIFEXITED
zend_long status_word;
+ int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
- if (WIFEXITED((int)status_word))
+ int_status_word = (int) status_word;
+ if (WIFEXITED(int_status_word))
RETURN_TRUE;
#endif
@@ -775,12 +777,14 @@ PHP_FUNCTION(pcntl_wifstopped)
{
#ifdef WIFSTOPPED
zend_long status_word;
+ int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
- if (WIFSTOPPED((int)status_word))
+ int_status_word = (int) status_word;
+ if (WIFSTOPPED(int_status_word))
RETURN_TRUE;
#endif
RETURN_FALSE;
@@ -793,12 +797,14 @@ PHP_FUNCTION(pcntl_wifsignaled)
{
#ifdef WIFSIGNALED
zend_long status_word;
+ int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
- if (WIFSIGNALED((int)status_word))
+ int_status_word = (int) status_word;
+ if (WIFSIGNALED(int_status_word))
RETURN_TRUE;
#endif
RETURN_FALSE;
@@ -810,12 +816,14 @@ PHP_FUNCTION(pcntl_wifcontinued)
{
#ifdef HAVE_WCONTINUED
zend_long status_word;
+ int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
- if (WIFCONTINUED((int)status_word))
+ int_status_word = (int) status_word;
+ if (WIFCONTINUED(int_status_word))
RETURN_TRUE;
#endif
RETURN_FALSE;
@@ -829,12 +837,14 @@ PHP_FUNCTION(pcntl_wexitstatus)
{
#ifdef WEXITSTATUS
zend_long status_word;
+ int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
- RETURN_LONG(WEXITSTATUS((int)status_word));
+ int_status_word = (int) status_word;
+ RETURN_LONG(WEXITSTATUS(int_status_word));
#else
RETURN_FALSE;
#endif
@@ -847,12 +857,14 @@ PHP_FUNCTION(pcntl_wtermsig)
{
#ifdef WTERMSIG
zend_long status_word;
+ int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
- RETURN_LONG(WTERMSIG((int)status_word));
+ int_status_word = (int) status_word;
+ RETURN_LONG(WTERMSIG(int_status_word));
#else
RETURN_FALSE;
#endif
@@ -865,12 +877,14 @@ PHP_FUNCTION(pcntl_wstopsig)
{
#ifdef WSTOPSIG
zend_long status_word;
+ int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
- RETURN_LONG(WSTOPSIG((int)status_word));
+ int_status_word = (int) status_word;
+ RETURN_LONG(WSTOPSIG(int_status_word));
#else
RETURN_FALSE;
#endif