Skip to content

Commit 7690cbf

Browse files
committed
fix: handle the GNU specific version of strerror_r
1 parent ca5d482 commit 7690cbf

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

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)