From c33e7308ad8a6ff29c103fb31289931ba59cf75e Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Tue, 15 Apr 2014 00:43:53 -0300 Subject: [PATCH] ws2_32: Use the correct address family in gethostbyaddr. --- dlls/ws2_32/socket.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index fe853560060..54e7e2f20f3 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -5084,6 +5084,7 @@ struct WS_hostent* WINAPI WS_gethostbyaddr(const char *addr, int len, int type) { struct WS_hostent *retval = NULL; struct hostent* host; + int unixtype = convert_af_w2u(type); #ifdef HAVE_LINUX_GETHOSTBYNAME_R_6 char *extrabuf; @@ -5093,7 +5094,7 @@ struct WS_hostent* WINAPI WS_gethostbyaddr(const char *addr, int len, int type) host = NULL; extrabuf=HeapAlloc(GetProcessHeap(),0,ebufsize) ; while(extrabuf) { - int res = gethostbyaddr_r(addr, len, type, + int res = gethostbyaddr_r(addr, len, unixtype, &hostentry, extrabuf, ebufsize, &host, &locerr); if( res != ERANGE) break; ebufsize *=2; @@ -5102,7 +5103,7 @@ struct WS_hostent* WINAPI WS_gethostbyaddr(const char *addr, int len, int type) if (!host) SetLastError((locerr < 0) ? wsaErrno() : wsaHerrno(locerr)); #else EnterCriticalSection( &csWSgetXXXbyYYY ); - host = gethostbyaddr(addr, len, type); + host = gethostbyaddr(addr, len, unixtype); if (!host) SetLastError((h_errno < 0) ? wsaErrno() : wsaHerrno(h_errno)); #endif if( host != NULL ) retval = WS_dup_he(host); @@ -6408,7 +6409,7 @@ static struct WS_hostent *WS_dup_he(const struct hostent* p_he) p_to = WS_create_he(p_he->h_name, i + 1, alias_size, addresses + 1, p_he->h_length); if (!p_to) return NULL; - p_to->h_addrtype = p_he->h_addrtype; + p_to->h_addrtype = convert_af_u2w(p_he->h_addrtype); p_to->h_length = p_he->h_length; for(i = 0, p = p_to->h_addr_list[0]; p_he->h_addr_list[i]; i++, p += p_to->h_length)