]> granicus.if.org Git - php/commitdiff
Fix the compile problem on some systems that do not have hstrerror()
authorfoobar <sniper@php.net>
Tue, 12 Jun 2001 04:42:01 +0000 (04:42 +0000)
committerfoobar <sniper@php.net>
Tue, 12 Jun 2001 04:42:01 +0000 (04:42 +0000)
ext/sockets/config.m4
ext/sockets/sockets.c

index aa3a4606b3b6ba3eecc52ecc5e7b4d1b5d06c792..af99809231b6afabff6a6848207da6366d12d579 100644 (file)
@@ -6,6 +6,7 @@ PHP_ARG_ENABLE(sockets, whether to enable sockets support,
 
 if test "$PHP_SOCKETS" != "no"; then
 
+  AC_CHECK_FUNCS(hstrerror)
   AC_CHECK_HEADERS(netdb.h netinet/tcp.h sys/un.h errno.h)
   AC_DEFINE(HAVE_SOCKETS, 1, [ ])
 
index ce86c6452f9b9a3ce1767fafa801b17d048a291b..bc1f04914f3e37c9d6a4dfee1a7e063be0342f66 100644 (file)
@@ -962,7 +962,14 @@ PHP_FUNCTION(socket_strerror)
 #ifndef PHP_WIN32
        if (Z_LVAL_PP(arg1) < -10000) {
                Z_LVAL_PP(arg1) += 10000;
-               buf = hstrerror(-(Z_LVAL_PP(arg1)));
+#ifdef HAVE_HSTRERROR
+               buf = hstrerror(-(Z_LVAL_PP(arg1)));
+#else
+               {
+               static char buf[100];
+               sprintf (buf, "Host lookup error %d", -(Z_LVAL_PP(arg1)));
+               }
+#endif 
        } else {
                buf = strerror(-(Z_LVAL_PP(arg1)));
        }