summaryrefslogtreecommitdiff
path: root/ares_init.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-09-11 20:25:13 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-09-11 20:25:13 +0000
commitd3439e3332613dd0271fec868658bb6e75f80ab9 (patch)
treef8c6a527b78420eb9b31e15bccb8b3517c9ee585 /ares_init.c
parent1bec3073dc3ef1f22981f289edb8985b1ecb8a9b (diff)
downloadc-ares-d3439e3332613dd0271fec868658bb6e75f80ab9.tar.gz
c-ares-d3439e3332613dd0271fec868658bb6e75f80ab9.tar.bz2
c-ares-d3439e3332613dd0271fec868658bb6e75f80ab9.zip
- Guilherme Balena Versiani: I noted a strange BUG in Win32 port
(ares_init.c/get_iphlpapi_dns_info() function): when I disable the network by hand or disconnect the network cable in Windows 2000 or Windows XP, my application gets 127.0.0.1 as the only name server. The problem comes from 'GetNetworkParams' function, that returns the empty string "" as the only name server in that case. Moreover, the Windows implementation of inet_addr() returns INADDR_LOOPBACK instead of INADDR_NONE.
Diffstat (limited to 'ares_init.c')
-rw-r--r--ares_init.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ares_init.c b/ares_init.c
index 6c9e412..a0c1865 100644
--- a/ares_init.c
+++ b/ares_init.c
@@ -373,7 +373,8 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size)
printf ("DNS Servers:\n"
" %s (primary)\n", fi->DnsServerList.IpAddress.String);
}
- if (inet_addr(fi->DnsServerList.IpAddress.String) != INADDR_NONE &&
+ if (strlen(fi->DnsServerList.IpAddress.String) > 0 &&
+ inet_addr(fi->DnsServerList.IpAddress.String) != INADDR_NONE &&
left > ip_size)
{
ret += sprintf (ret, "%s,", fi->DnsServerList.IpAddress.String);