Skip to content
Snippets Groups Projects
Commit b2be6799 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

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
parent ea2618fc
No related branches found
No related tags found
No related merge requests found
...@@ -202,6 +202,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, ...@@ -202,6 +202,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
struct addrinfo hints, *res; struct addrinfo hints, *res;
int error; int error;
char sbuf[NI_MAXSERV]; char sbuf[NI_MAXSERV];
char *sbufptr = NULL;
char addrbuf[128]; char addrbuf[128];
curl_socket_t s; curl_socket_t s;
int pf; int pf;
...@@ -255,8 +256,11 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, ...@@ -255,8 +256,11 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
hints.ai_socktype = conn->socktype; hints.ai_socktype = conn->socktype;
hints.ai_flags = ai_flags; hints.ai_flags = ai_flags;
snprintf(sbuf, sizeof(sbuf), "%d", port); if(port) {
error = getaddrinfo(hostname, sbuf, &hints, &res); snprintf(sbuf, sizeof(sbuf), "%d", port);
sbufptr=sbuf;
}
error = getaddrinfo(hostname, sbufptr, &hints, &res);
if (error) { if (error) {
infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port); infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port);
return NULL; return NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment