fix: handle the GNU specific version of strerror_r

Close GH-11882
This commit is contained in:
Kévin Dunglas 2023-08-05 18:03:46 +02:00 committed by David CARLIER
parent dddd309da4
commit 96885bc04f
3 changed files with 15 additions and 4 deletions

3
NEWS
View File

@ -8,6 +8,9 @@ PHP NEWS
. Fixed bug GH-10964 (Improve man page about the built-in server).
(Alexandre Daubois)
- Core:
. Fixed strerror_r detection at configuration time. (Kévin Dunglas)
- DOM:
. Fix DOMEntity field getter bugs. (nielsdos)
. Fix incorrect attribute existence check in DOMElement::setAttributeNodeNS.

View File

@ -1649,9 +1649,15 @@ ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *
ZEND_API ZEND_COLD ZEND_NORETURN void zend_strerror_noreturn(int type, int errn, const char *message)
{
#ifdef HAVE_STR_ERROR_R
char buf[1024];
strerror_r(errn, buf, sizeof(buf));
#ifdef HAVE_STRERROR_R
char b[1024];
# ifdef STRERROR_R_CHAR_P
char *buf = strerror_r(errn, b, sizeof(b));
# else
strerror_r(errn, b, sizeof(b));
char *buf = b;
# endif
#else
char *buf = strerror(errn);
#endif

View File

@ -621,9 +621,11 @@ vasprintf \
asprintf \
nanosleep \
memmem \
strerror_r \
)
dnl Check for strerror_r, and if its a POSIX-compatible or a GNU specific version.
AC_FUNC_STRERROR_R
AX_FUNC_WHICH_GETHOSTBYNAME_R
dnl Some systems (like OpenSolaris) do not have nanosleep in libc.