AC_CHECK_FUNCS([bzero])
AC_CHECK_FUNCS([ftruncate])
AC_CHECK_FUNCS([gethostbyname])
+AC_CHECK_FUNCS([gethostbyname_r])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
gboolean
thrift_socket_open (ThriftTransport *transport, GError **error)
{
- struct hostent he, *hp = NULL;
+ struct hostent *hp = NULL;
struct sockaddr_in pin;
int err;
+#if defined(HAVE_GETHOSTBYNAME_R)
+ struct hostent he;
char buf[1024];
+#endif
ThriftSocket *tsocket = THRIFT_SOCKET (transport);
g_return_val_if_fail (tsocket->sd == 0, FALSE);
/* lookup the destination host */
- if (gethostbyname_r(tsocket->hostname, &he, buf, 1024, &hp, &err) != 0 || hp == NULL) {
+#if defined(HAVE_GETHOSTBYNAME_R)
+ if (gethostbyname_r (tsocket->hostname, &he, buf, 1024, &hp, &err) != 0 || hp == NULL)
+#else
+ if ((hp = gethostbyname (tsocket->hostname)) == NULL && (err = h_errno))
+#endif
+ {
/* host lookup failed, bail out with an error */
g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_HOST,
"host lookup failed for %s:%d - %s",