]> granicus.if.org Git - curl/commitdiff
- Guilherme Balena Versiani: I noted a strange BUG in Win32 port
authorDaniel Stenberg <daniel@haxx.se>
Mon, 11 Sep 2006 20:25:13 +0000 (20:25 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 11 Sep 2006 20:25:13 +0000 (20:25 +0000)
  (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.

ares/CHANGES
ares/ares_init.c

index 0a927c284d6807f3b5a8fb551d896fa68598fa1a..2e0393b1803c183e0dbdbcb2701eba81392649c1 100644 (file)
@@ -1,5 +1,15 @@
   Changelog for the c-ares project
 
+* September 11 2006
+
+- 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.
+
 * August 29 2006
 
 - Brad Spencer did
index 6c9e412b0239913c6a9193c3ab9fdb70c866fc8c..a0c18653bdd0b1ef255f2fe22a94f420f7cef49e 100644 (file)
@@ -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);