cURL / Mailing Lists / curl-library / Single Mail


Re: Re: DNS Resolve problems on 2.4.18 Linux

From: Dan C <>
Date: Mon, 27 Oct 2003 10:35:01 -0800 (PST)

>> I only have one concern here: 'errno' is not generally thread-safe.
Yes I hear that concern... doing a little more digging and adding some more trace info, here is what comes back from glibc when only using h_errnop. Looks like a bug in glibc. I have to put some more traces in the glibc to see exactly where it is coming from. This code reflects changing errno to h_errnop. Notice h_errno is also set to (-1), but errno is set to ERANGE. Very strange....
bash-2.05b# curl --trace trace.txt ftp://localhost/test
curl: (6) Couldn't resolve host 'localhost'
bash-2.05b# cat trace.txt
== Info: gethostbyname_r(2) trying to resolve localhost
== Info: gethostbyname_r(2) failed res: (-1), h_errnop: (-1), errno: (34)
== Info: gethostbyname_r(2) breaking..res=-1
== Info: gethostbyname_r(2) failed for localhost
== Info: Couldn't resolve host 'localhost'
== Info: Closing connection #0

Here is the source producing the about output....
      if ( res < 0) {
          infof(data, "gethostbyname_r(2) failed res: (%d), h_errnop: (%d), errno: (%d) \nERANGE=%d, EAGAIN=%d\n", res, h_errnop, errno, ERANGE, EAGAIN );
      if (( res < 0 ) && ((ERANGE == h_errnop) || (EAGAIN == h_errnop))) {
          if ( ERANGE == h_errnop)
            infof(data, "gethostbyname_r(2) failed (ERANGE).\n" );
            infof(data, "gethostbyname_r(2) failed (EAGAIN).\n" );
      } else if (( ERANGE == res ) || (EAGAIN == res)) {

Do you Yahoo!?
Exclusive Video Premiere - Britney Spears

This email is sponsored by: The Donation Program.
Do you like what is doing for the Open
Source Community? Make a contribution, and help us add new
features and functionality. Click here:
Received on 2003-10-27