Author: cgutman
Date: Sun Aug 19 07:32:47 2012
New Revision: 57107
URL:
http://svn.reactos.org/svn/reactos?rev=57107&view=rev
Log:
[WS2_32]
- Set last error inside getaddrinfo to properly mask some non-fatal errors generated by
adns
Modified:
trunk/reactos/dll/win32/ws2_32/misc/ns.c
Modified: trunk/reactos/dll/win32/ws2_32/misc/ns.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/misc/ns.c…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] Sun Aug 19 07:32:47 2012
@@ -1598,14 +1598,24 @@
DNS_STATUS dns_status;
PDNS_RECORD dp, currdns;
struct sockaddr_in *sin;
+ INT error;
if (res == NULL)
- return WSAEINVAL;
+ {
+ error = WSAEINVAL;
+ goto End;
+ }
if (nodename == NULL && servname == NULL)
- return WSAHOST_NOT_FOUND;
+ {
+ error = WSAHOST_NOT_FOUND;
+ goto End;
+ }
if (!WSAINITIALIZED)
- return WSANOTINITIALISED;
+ {
+ error = WSANOTINITIALISED;
+ goto End;
+ }
if (servname)
{
@@ -1619,14 +1629,20 @@
{
pent = getprotobynumber(hints->ai_protocol);
if (pent == NULL)
- return WSAEINVAL;
+ {
+ error = WSAEINVAL;
+ goto End;
+ }
proto = pent->p_name;
}
else
proto = NULL;
se = getservbyname(servname, proto);
if (se == NULL)
- return WSATYPE_NOT_FOUND;
+ {
+ error = WSATYPE_NOT_FOUND;
+ goto End;
+ }
port = se->s_port;
}
else
@@ -1639,7 +1655,10 @@
{
/* Is it an IPv6 address? */
if (strstr(nodename, ":"))
- return WSAHOST_NOT_FOUND;
+ {
+ error = WSAHOST_NOT_FOUND;
+ goto End;
+ }
/* Is it an IPv4 address? */
addr = inet_addr(nodename);
@@ -1729,16 +1748,24 @@
}
if (ret == NULL)
- return WSAHOST_NOT_FOUND;
+ {
+ error = WSAHOST_NOT_FOUND;
+ goto End;
+ }
if (hints && hints->ai_family != PF_UNSPEC && hints->ai_family
!= PF_INET)
{
freeaddrinfo(ret);
- return WSAEAFNOSUPPORT;
+ error = WSAEAFNOSUPPORT;
+ goto End;
}
*res = ret;
- return 0;
+ error = 0;
+
+End:
+ WSASetLastError(error);
+ return error;
}
/* EOF */