2008/5/19 Hans Leidekker <hans(a)it.vu.nl>:
@@ -151,7 +158,21 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort, name = HeapAlloc(GetProcessHeap(), 0, sz+1); WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, name, sz, NULL, NULL ); name[sz] = 0; + +#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6 + phe = NULL; + buf = HeapAlloc(GetProcessHeap(), 0, bufsize); + while (buf) + { + int res = gethostbyname_r(name, &hostentry, buf, bufsize, &phe, &locerr); + if (res != ERANGE) break; + bufsize *= 2; + buf = HeapReAlloc(GetProcessHeap(), 0, buf, bufsize); + } + HeapFree(GetProcessHeap(), 0, buf); +#else phe = gethostbyname(name); +#endif
In the long term it would be better to use getaddrinfo instead of gethostbyname/gethostbyname_r, but that's too big a change for 1.0. Rob