From: Daniel Stenberg Date: Mon, 10 Oct 2005 18:28:05 +0000 (+0000) Subject: pass a NULL pointer in the service argument (the second) if the port number X-Git-Tag: upstream/7.37.1~10852 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2be6799f2be7fa103ef61cbe2a053973d008a5d;p=platform%2Fupstream%2Fcurl.git 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 --- diff --git a/lib/hostip6.c b/lib/hostip6.c index be86a51..aa25de3 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;