X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fgetaddrinfo.c;h=97a3c1ef03730f9c1938ad06a0e558ea89e12053;hb=19a0803f7298f5a0d583f5f70582ba29cb373265;hp=ed8ff7079f59f1a2b35eb7d8d10df80d80257803;hpb=f3fe3fc7be5a8f3ab944a72f51dbc828d2ad743d;p=pazpar2-moved-to-github.git diff --git a/src/getaddrinfo.c b/src/getaddrinfo.c index ed8ff70..97a3c1e 100644 --- a/src/getaddrinfo.c +++ b/src/getaddrinfo.c @@ -69,7 +69,7 @@ void perform_getaddrinfo(struct work *w) { struct addrinfo hints, *res; char host[512], *cp; - const char *port = 0; + char *port = 0; int error; hints.ai_flags = 0; @@ -96,13 +96,14 @@ void perform_getaddrinfo(struct work *w) } else { + char n_host[512]; if (getnameinfo((struct sockaddr *) res->ai_addr, res->ai_addrlen, - host, sizeof(host)-1, + n_host, sizeof(n_host)-1, 0, 0, NI_NUMERICHOST) == 0) { - w->ipport = xmalloc(strlen(host) + (port ? strlen(port) : 0) + 2); - strcpy(w->ipport, host); + w->ipport = xmalloc(strlen(n_host) + (port ? strlen(port) : 0) + 2); + strcpy(w->ipport, n_host); if (port) { strcat(w->ipport, ":");