Skip to content

fix: handle GNU specific versions of strerror_r() #11882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down