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
This commit is contained in:
Bob Weinand 2018-02-28 02:13:28 +01:00
parent b53e547d85
commit 3f32bd9f43

View File

@ -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