aboutsummaryrefslogtreecommitdiff
path: root/lib/hostip.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-08-04 11:27:17 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-08-04 11:27:17 +0000
commit02f994a715c3afae203ad99a71e52ea284523c40 (patch)
treec9d47274d4c6a52bc8af18902ea2b88b097b17d2 /lib/hostip.c
parentf0ced0110fd3014b78e06478a244ff2d8b4df21e (diff)
Fixed to use the new HAVE_GETHOSTBYxxxx_R_x defines, now trying to support
the AIX-style as well. The AIX-stuff is *NOT* verified to work.
Diffstat (limited to 'lib/hostip.c')
-rw-r--r--lib/hostip.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 9b402f1cb..6bccab8fc 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -116,31 +116,45 @@ struct hostent *GetHost(struct UrlData *data,
h->h_name = *(h->h_addr_list) + h->h_length;
/* bad one h->h_name = (char*)(h->h_addr_list + h->h_length); */
MakeIP(ntohl(in),h->h_name,buf_size - (long)(h->h_name) + (long)buf);
-#if defined(HAVE_GETHOSTBYNAME_R)
}
+#if defined(HAVE_GETHOSTBYNAME_R)
else {
int h_errnop;
memset(buf,0,buf_size); /* workaround for gethostbyname_r bug in qnx nto */
-#if (GETHOSTBYNAME_R_NARGS < 6)
+#ifdef HAVE_GETHOSTBYNAME_R_5
/* Solaris, IRIX and more */
if ((h = gethostbyname_r(hostname,
- (struct hostent *)buf,buf +
- sizeof(struct hostent),buf_size -
- sizeof(struct hostent),&h_errnop)) == NULL )
-#else
- /* Linux */
- if( gethostbyname_r(hostname,
- (struct hostent *)buf,buf +
- sizeof(struct hostent),buf_size -
- sizeof(struct hostent),
- &h, /* DIFFERENCE */
- &h_errnop))
+ (struct hostent *)buf,
+ buf + sizeof(struct hostent),
+ buf_size - sizeof(struct hostent),
+ &h_errnop)) == NULL )
+#endif
+#ifdef HAVE_GETHOSTBYNAME_R_6
+ /* Linux */
+ if( gethostbyname_r(hostname,
+ (struct hostent *)buf,
+ buf + sizeof(struct hostent),
+ buf_size - sizeof(struct hostent),
+ &h, /* DIFFERENCE */
+ &h_errnop))
+#endif
+#ifdef HAVE_GETHOSTBYNAME_R_3
+ /* AIX, Digital Unix, more? */
+
+ /* August 4th, 2000. I don't have any such system around so I write this
+ blindly in hope it might work or that someone else will help me fix
+ this. */
+
+ h = gethostbyname_r(hostname,
+ (struct hostent *)buf,
+ (struct hostent_data *) buf + sizeof(struct hostent));
+ *h_errnop= errno; /* we don't deal with this, but set it anyway */
+ if(NULL == h)
#endif
{
infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
}
#else
- }
else {
if ((h = gethostbyname(hostname)) == NULL ) {
infof(data, "gethostbyname(2) failed for %s\n", hostname);