* http.c (connect_server): Properly handle a single A record that fails
authorDavid Shaw <dshaw@jabberwocky.com>
Fri, 11 Oct 2002 02:24:59 +0000 (02:24 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Fri, 11 Oct 2002 02:24:59 +0000 (02:24 +0000)
connect().

util/ChangeLog
util/http.c

index 142a389..26dbed6 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-10  David Shaw  <dshaw@jabberwocky.com>
+
+       * http.c (connect_server): Properly handle a single A record that
+       fails connect().
+
 2002-10-03  David Shaw  <dshaw@jabberwocky.com>
 
        * logger.c (g10_log_warning, log_set_strict): Add new log_warning
index 7f356bc..e76ab94 100644 (file)
@@ -770,17 +770,18 @@ connect_server( const char *server, ushort port )
 
     /* Try all A records until one responds. TODO: do this on the
        MINGW32 side as well. */
-    do
+
+    while(host->h_addr_list[i])
       {
        addr.sin_addr = *(struct in_addr*)host->h_addr_list[i];
+
        if(connect( sd, (struct sockaddr *)&addr, sizeof addr) == 0)
          break;
 
        i++;
       }
-    while(addr.sin_addr.s_addr!=0);
 
-    if(addr.sin_addr.s_addr==0)
+    if(host->h_addr_list[i]==0)
       {
        sock_close(sd);
        return -1;