diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hostip.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/hostip.c b/lib/hostip.c index b5fda2a23..2cee362d1 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -696,6 +696,19 @@ static Curl_addrinfo *my_getaddrinfo(struct SessionHandle *data, #ifdef HAVE_GETHOSTBYNAME_R_3 /* AIX, Digital Unix, HPUX 10, more? */ + /* For AIX 4.3 or later, we don't use gethostbyname_r() at all, because of + the plain fact that it does not return unique full buffers on each + call, but instead several of the pointers in the hostent structs will + point to the same actual data! This have the unfortunate down-side that + our caching system breaks down horribly. Luckily for us though, AIX 4.3 + and more recent versions have a completely thread-safe libc where all + the data is stored in thread-specific memory areas making calls to the + plain old gethostbyname() work fine even for multi-threaded programs. + + This AIX 4.3 or later detection is all made in the configure script. + + Troels Walsted Hansen helped us work this out on March 3rd, 2003. */ + if(CURL_NAMELOOKUP_SIZE >= (sizeof(struct hostent)+sizeof(struct hostent_data))) @@ -705,7 +718,8 @@ static Curl_addrinfo *my_getaddrinfo(struct SessionHandle *data, ret = gethostbyname_r(hostname, (struct hostent *)buf, - (struct hostent_data *)((char *)buf + sizeof(struct hostent))); + (struct hostent_data *)((char *)buf + + sizeof(struct hostent))); else ret = -1; /* failure, too smallish buffer size */ |