If the platform supports gethostbyname_r(most i know do), that is thread safe.
-Jason On Tue, 2003-07-08 at 00:00, Sara Golemon wrote: > pollita Tue Jul 8 01:00:15 2003 EDT > > Modified files: > /php-src/ext/sockets sockets.c > Log: > gethostbyname2() not thread safe. Use getaddrinfo() or nothing at all. > > Index: php-src/ext/sockets/sockets.c > diff -u php-src/ext/sockets/sockets.c:1.145 php-src/ext/sockets/sockets.c:1.146 > --- php-src/ext/sockets/sockets.c:1.145 Mon Jul 7 23:38:00 2003 > +++ php-src/ext/sockets/sockets.c Tue Jul 8 01:00:13 2003 > @@ -19,7 +19,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: sockets.c,v 1.145 2003/07/08 03:38:00 pollita Exp $ */ > +/* $Id: sockets.c,v 1.146 2003/07/08 05:00:13 pollita Exp $ */ > > #ifdef HAVE_CONFIG_H > #include "config.h" > @@ -381,8 +381,6 @@ > #ifdef HAVE_GETADDRINFO > struct addrinfo hints; > struct addrinfo *addrinfo = NULL; > -#elif defined(HAVE_GETHOSTBYNAME2) > - struct hostent *host_entry; > #endif > > if (inet_pton(AF_INET6, string, &tmp)) { > @@ -410,25 +408,9 @@ > memcpy(&(sin6->sin6_addr.s6_addr), ((struct > sockaddr_in6*)(addrinfo->ai_addr))->sin6_addr.s6_addr, sizeof(struct in6_addr)); > freeaddrinfo(addrinfo); > > -#elif defined(HAVE_GETHOSTBYNAME2) > - > - if (! (host_entry = gethostbyname2(string, AF_INET6))) { > -#ifdef PHP_WIN32 > - PHP_SOCKET_ERROR(php_sock, "Host lookup failed", > WSAGetLastError()); > -#else > - PHP_SOCKET_ERROR(php_sock, "Host lookup failed", (-10000 - > h_errno)); > -#endif > - return 0; > - } > - if (host_entry->h_addrtype != AF_INET6) { > - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host lookup > failed: Non AF_INET6 domain returned on AF_INET6 socket"); > - return 0; > - } > - memcpy(&(sin6->sin6_addr.s6_addr), host_entry->h_addr_list[0], > host_entry->h_length); > - > #else > /* No IPv6 specific hostname resolution is available on this system? */ > - php_error_docref(NULL TSRMLS_CC, E_WARNING, "No IPv6 compatable > hostname resolution available on system."); > + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host lookup failed: > getaddrinfo() not available on system."); > reurn 0; > #endif > -- Jason Greene <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php