Skip to content

Commit c113584

Browse files
author
foobar
committed
MFH
1 parent b52d710 commit c113584

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

ext/sockets/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PHP_ARG_ENABLE(sockets, whether to enable sockets support,
77
if test "$PHP_SOCKETS" != "no"; then
88

99
AC_CHECK_HEADERS(netdb.h netinet/tcp.h sys/un.h errno.h)
10+
AC_CHECK_FUNCS(hstrerror)
1011
AC_DEFINE(HAVE_SOCKETS, 1, [ ])
11-
1212
PHP_EXTENSION(sockets, $ext_shared)
1313
fi

ext/sockets/sockets.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,14 @@ PHP_FUNCTION(strerror)
10931093
}
10941094
if (Z_LVAL_PP(error) < -10000) {
10951095
Z_LVAL_PP(error) += 10000;
1096-
buf = hstrerror(-(Z_LVAL_PP(error)));
1096+
#ifdef HAVE_HSTRERROR
1097+
buf = hstrerror(-(Z_LVAL_PP(error)));
1098+
#else
1099+
{
1100+
static char buf[100];
1101+
sprintf (buf, "Host lookup error %d", -(Z_LVAL_PP(error)));
1102+
}
1103+
#endif
10971104
} else {
10981105
buf = strerror(-(Z_LVAL_PP(error)));
10991106
}

0 commit comments

Comments
 (0)