summaryrefslogtreecommitdiff
path: root/lib/hostip6.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-10-10 18:28:05 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-10-10 18:28:05 +0000
commitb2be6799f2be7fa103ef61cbe2a053973d008a5d (patch)
tree3e3f9b167c574b1f688d08ac707633674d27d066 /lib/hostip6.c
parentea2618fc6f8e616e834c4d65efce577b41f51e61 (diff)
downloadcurl-b2be6799f2be7fa103ef61cbe2a053973d008a5d.tar.gz
pass a NULL pointer in the service argument (the second) if the port number
was 0 as it seems at least some AIX versions don't like a "0" string there
Diffstat (limited to 'lib/hostip6.c')
-rw-r--r--lib/hostip6.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/hostip6.c b/lib/hostip6.c
index be86a5136..aa25de3e9 100644
--- a/lib/hostip6.c
+++ b/lib/hostip6.c
@@ -202,6 +202,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
struct addrinfo hints, *res;
int error;
char sbuf[NI_MAXSERV];
+ char *sbufptr = NULL;
char addrbuf[128];
curl_socket_t s;
int pf;
@@ -255,8 +256,11 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
hints.ai_socktype = conn->socktype;
hints.ai_flags = ai_flags;
- snprintf(sbuf, sizeof(sbuf), "%d", port);
- error = getaddrinfo(hostname, sbuf, &hints, &res);
+ if(port) {
+ snprintf(sbuf, sizeof(sbuf), "%d", port);
+ sbufptr=sbuf;
+ }
+ error = getaddrinfo(hostname, sbufptr, &hints, &res);
if (error) {
infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port);
return NULL;