diff --git a/configure.ac b/configure.ac index ded516b01f095..e830acfb25582 100644 --- a/configure.ac +++ b/configure.ac @@ -601,6 +601,9 @@ AX_FUNC_WHICH_GETHOSTBYNAME_R dnl Some systems (like OpenSolaris) do not have nanosleep in libc. PHP_CHECK_FUNC_LIB(nanosleep, rt) +dnl Haiku does not have network api in libc. +PHP_CHECK_FUNC_LIB(setsockopt, network) + dnl Check for getaddrinfo, should be a better way, but... Also check for working dnl getaddrinfo. AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo, diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c index 3f0241a8e0376..e7c3d752919b2 100644 --- a/ext/gd/libgd/gd_jpeg.c +++ b/ext/gd/libgd/gd_jpeg.c @@ -47,7 +47,7 @@ typedef struct _jmpbuf_wrapper int ignore_warning; } jmpbuf_wrapper; -static long php_jpeg_emit_message(j_common_ptr jpeg_info, int level) +static void php_jpeg_emit_message(j_common_ptr jpeg_info, int level) { char message[JMSG_LENGTH_MAX]; jmpbuf_wrapper *jmpbufw; @@ -81,11 +81,9 @@ static long php_jpeg_emit_message(j_common_ptr jpeg_info, int level) } } } - return 1; } - /* Called by the IJG JPEG library upon encountering a fatal error */ static void fatal_jpeg_error (j_common_ptr cinfo) { @@ -356,8 +354,7 @@ gdImagePtr gdImageCreateFromJpegCtxEx (gdIOCtx * infile, int ignore_warning) cinfo.err = jpeg_std_error (&jerr); cinfo.client_data = &jmpbufw; - - cinfo.err->emit_message = (void (*)(j_common_ptr,int)) php_jpeg_emit_message; + cinfo.err->emit_message = php_jpeg_emit_message; if (setjmp (jmpbufw.jmpbuf) != 0) { /* we're here courtesy of longjmp */ diff --git a/ext/opcache/jit/zend_jit_perf_dump.c b/ext/opcache/jit/zend_jit_perf_dump.c index 663f9ae1e05cc..e61c49289535e 100644 --- a/ext/opcache/jit/zend_jit_perf_dump.c +++ b/ext/opcache/jit/zend_jit_perf_dump.c @@ -22,9 +22,10 @@ #include #include #include -#include -#if defined(__darwin__) +#if defined(__linux__) +#include +#elif defined(__darwin__) # include #elif defined(__FreeBSD__) # include diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 090f47a79536d..a697c0c4677eb 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -883,8 +883,14 @@ PHP_FUNCTION(posix_getgrgid) grbuf = emalloc(grbuflen); +try_again: ret = getgrgid_r(gid, &_g, grbuf, grbuflen, &retgrptr); if (ret || retgrptr == NULL) { + if (errno == ERANGE) { + grbuflen *= 2; + grbuf = erealloc(grbuf, grbuflen); + goto try_again; + } POSIX_G(last_error) = ret; efree(grbuf); RETURN_FALSE; @@ -952,7 +958,13 @@ PHP_FUNCTION(posix_getpwnam) buf = emalloc(buflen); pw = &pwbuf; +try_again: if (getpwnam_r(name, pw, buf, buflen, &pw) || pw == NULL) { + if (errno == ERANGE) { + buflen *= 2; + buf = erealloc(buf, buflen); + goto try_again; + } efree(buf); POSIX_G(last_error) = errno; RETURN_FALSE; @@ -1001,8 +1013,14 @@ PHP_FUNCTION(posix_getpwuid) } pwbuf = emalloc(pwbuflen); +try_again: ret = getpwuid_r(uid, &_pw, pwbuf, pwbuflen, &retpwptr); if (ret || retpwptr == NULL) { + if (errno == ERANGE) { + pwbuflen *= 2; + pwbuf = erealloc(pwbuf, pwbuflen); + goto try_again; + } POSIX_G(last_error) = ret; efree(pwbuf); RETURN_FALSE; diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index b33face760ff7..fe18e9b92aa9f 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -128,7 +128,7 @@ PHP_FUNCTION(getrusage) #ifdef PHP_WIN32 /* Windows only implements a limited amount of fields from the rusage struct */ PHP_RUSAGE_PARA(ru_majflt); PHP_RUSAGE_PARA(ru_maxrss); -#elif !defined(_OSD_POSIX) +#elif !defined(_OSD_POSIX) && !defined(__HAIKU__) PHP_RUSAGE_PARA(ru_oublock); PHP_RUSAGE_PARA(ru_inblock); PHP_RUSAGE_PARA(ru_msgsnd); diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index ea0653fd25e2b..f978c21ea348d 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -1683,6 +1683,9 @@ int main(int argc, char **argv) /* {{{ */ } #ifndef _WIN32 +# ifndef SIGIO +# define SIGIO SIGPOLL +# endif zend_sigaction(SIGIO, &sigio_struct, NULL); #endif