--- trunk/http-host.c 2008/05/31 21:49:04 117 +++ trunk/http-host.c 2008/05/31 22:32:16 118 @@ -27,6 +27,15 @@ #include "util.h" int xgethostbyname(const char * host, struct in_addr * a) { +#ifdef __CYGWIN__ + /* cygwin's gethostbyname is thread-safe */ + struct hostent * p = gethostbyname(host); + if (p == NULL || p->h_addrtype != AF_INET) { + return -1; + } + *a = *((struct in_addr *) p->h_addr); + return 0; +#else struct hostent h; struct hostent * p; char * buffer; @@ -47,4 +56,5 @@ *a = *((struct in_addr *) p->h_addr); free(buffer); return 0; +#endif }