]> granicus.if.org Git - curl/commitdiff
Another glibc resolve name fix
authorDaniel Stenberg <daniel@haxx.se>
Tue, 28 Oct 2003 13:06:15 +0000 (13:06 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 28 Oct 2003 13:06:15 +0000 (13:06 +0000)
CHANGES
RELEASE-NOTES
lib/hostip.c

diff --git a/CHANGES b/CHANGES
index e9b6c64c6881fe50ab841105e08db15781a22ee8..cd7c715e7877dac825cfeb83cb4855198e026f22 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,13 @@
                                   Changelog
 
 
+Daniel (28 October)
+- Dan C tracked down yet another weird behavior in the glibc gethostbyname_r()
+  function for some specific versions (reported on 2.2.5 and 2.1.1), and
+  provided a fix. On Linux machines with these glibc versioins, non-ipv6
+  builds of libcurl would often fail to resolve perfectly resolvable host
+  names.
+
 Daniel (26 October)
 - James Bursa found out that curl_msnprintf() could write the trailing
   zero-byte outside its given buffer size. This could happen if you generated
index f5d1cd081b3c48db7912a9a8c83d82750a9866ed..894ca0ca47f93a8ddb5c85548e0cea397143b650 100644 (file)
@@ -24,6 +24,7 @@ This release includes the following changes:
 
 This release includes the following bugfixes:
 
+ o added work-around for a name resolve problem on some glibc versions
  o a rare ERRORBUFFER single-byte overflow was fixed
  o HTTP-resuming an already downloaded file works better
  o builds better on Solaris 8+ with gcc
@@ -83,6 +84,6 @@ advice from friends like these:
  Jeremy Friesner, Florian Schoppmann, Neil Dunbar, Frank Ticheler, Lachlan
  O'Dea, Dirk Manske, Domenico Andreoli, Gisle Vanem, Kimmo Kinnunen, Andrew
  Fuller, Georg Horn, Andrés García, Dylan Ellicott, Kevin Roth, David Hull,
- James Bursa
+ James Bursa, Dan C
  
         Thanks! (and sorry if I forgot to mention someone)
index 21227567e2bf13329784740bf74e7475c6367ee5..5a7ef2a4c041d540a975f273538fa2f3eee06c2a 100644 (file)
@@ -983,13 +983,28 @@ static Curl_addrinfo *my_getaddrinfo(struct connectdata *conn,
          of buffer size (step_size grows beyond CURL_NAMELOOKUP_SIZE).
 
          If anyone has a better fix, please tell us!
+
+         -------------------------------------------------------------------
+
+         On October 23rd 2003, Dan C dug up more details on the mysteries of
+         gethostbyname_r() in glibc:
+
+         In glibc 2.2.5 the interface is different (this has also been
+         discovered in glibc 2.1.1-6 as shipped by Redhat 6). What I can't
+         explain, is that tests performed on glibc 2.2.4-34 and 2.2.4-32
+         (shipped/upgraded by Redhat 7.2) don't show this behavior!
+
+         In this "buggy" version, the return code is -1 on error and 'errno'
+         is set to the ERANGE or EAGAIN code. Note that 'errno' is not a
+         thread-safe variable.
+
       */
 
-      if((ERANGE == res) || (EAGAIN == res)) {
+      if(((ERANGE == res) || (EAGAIN == res)) ||
+         ((res<0) && ((ERANGE == errno) || (EAGAIN == errno))))
        step_size+=200;
-       continue;
-      }
-      break;
+      else
+        break;
     } while(step_size <= CURL_NAMELOOKUP_SIZE);
 
     if(!h) /* failure */