projects
/
pazpar2-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2adcd1f
)
Use separate result var for getnameinfo PAZ-863
author
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 24 Apr 2013 20:01:03 +0000
(22:01 +0200)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 24 Apr 2013 20:01:03 +0000
(22:01 +0200)
src/getaddrinfo.c
patch
|
blob
|
history
diff --git
a/src/getaddrinfo.c
b/src/getaddrinfo.c
index
1b09ad3
..
97a3c1e
100644
(file)
--- a/
src/getaddrinfo.c
+++ b/
src/getaddrinfo.c
@@
-69,7
+69,6
@@
void perform_getaddrinfo(struct work *w)
{
struct addrinfo hints, *res;
char host[512], *cp;
{
struct addrinfo hints, *res;
char host[512], *cp;
- char portbuf[512]; // very big ports
char *port = 0;
int error;
char *port = 0;
int error;
@@
-87,8
+86,7
@@
void perform_getaddrinfo(struct work *w)
if ((cp = strrchr(host, ':')))
{
*cp = '\0';
if ((cp = strrchr(host, ':')))
{
*cp = '\0';
- port = portbuf;
- strncpy(port, cp + 1, sizeof(port));
+ port = cp + 1;
}
error = getaddrinfo(host, port ? port : "210", &hints, &res);
if (error)
}
error = getaddrinfo(host, port ? port : "210", &hints, &res);
if (error)
@@
-98,13
+96,14
@@
void perform_getaddrinfo(struct work *w)
}
else
{
}
else
{
+ char n_host[512];
if (getnameinfo((struct sockaddr *) res->ai_addr, res->ai_addrlen,
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)
{
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, ":");
if (port)
{
strcat(w->ipport, ":");