aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-03-03 22:23:48 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-03-03 22:23:48 +0000
commit8d5ac8b43cc1755f3376966e9686478013618d35 (patch)
tree569c382fdb3c56324415cf636b6054388412b955
parent17962b3d2eb8b99b45709cc65ed346b63394ec22 (diff)
AIX 4.3 or later should use gethostbyname() and not the *_r() version.
-rw-r--r--lib/hostip.c16
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 */