Skip to content

Commit 96885bc

Browse files
dunglasdevnexen
authored andcommitted
fix: handle the GNU specific version of strerror_r
Close GH-11882
1 parent dddd309 commit 96885bc

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ PHP NEWS
88
. Fixed bug GH-10964 (Improve man page about the built-in server).
99
(Alexandre Daubois)
1010

11+
- Core:
12+
. Fixed strerror_r detection at configuration time. (Kévin Dunglas)
13+
1114
- DOM:
1215
. Fix DOMEntity field getter bugs. (nielsdos)
1316
. Fix incorrect attribute existence check in DOMElement::setAttributeNodeNS.

Zend/zend.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,9 +1649,15 @@ ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *
16491649

16501650
ZEND_API ZEND_COLD ZEND_NORETURN void zend_strerror_noreturn(int type, int errn, const char *message)
16511651
{
1652-
#ifdef HAVE_STR_ERROR_R
1653-
char buf[1024];
1654-
strerror_r(errn, buf, sizeof(buf));
1652+
#ifdef HAVE_STRERROR_R
1653+
char b[1024];
1654+
1655+
# ifdef STRERROR_R_CHAR_P
1656+
char *buf = strerror_r(errn, b, sizeof(b));
1657+
# else
1658+
strerror_r(errn, b, sizeof(b));
1659+
char *buf = b;
1660+
# endif
16551661
#else
16561662
char *buf = strerror(errn);
16571663
#endif

configure.ac

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,11 @@ vasprintf \
621621
asprintf \
622622
nanosleep \
623623
memmem \
624-
strerror_r \
625624
)
626625

626+
dnl Check for strerror_r, and if its a POSIX-compatible or a GNU specific version.
627+
AC_FUNC_STRERROR_R
628+
627629
AX_FUNC_WHICH_GETHOSTBYNAME_R
628630

629631
dnl Some systems (like OpenSolaris) do not have nanosleep in libc.

0 commit comments

Comments
 (0)