diff options
author | Timo Sirainen <cras@irssi.org> | 2000-09-27 23:45:17 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-09-27 23:45:17 +0000 |
commit | 29c8c6e1cdb4b11ce4b352363f49d27cde10d8ad (patch) | |
tree | 01cf3511713b1f8d2d66cb703812caf3c323a1b4 | |
parent | 79100fea45a0514052d7202e97415e29c76479ac (diff) | |
download | irssi-29c8c6e1cdb4b11ce4b352363f49d27cde10d8ad.zip |
net_gethostbyaddr() fixed.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@685 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/core/network.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/core/network.c b/src/core/network.c index 7c800ac1..4a60a963 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -362,7 +362,6 @@ int net_gethostbyaddr(IPADDR *ip, char **name) { #ifdef HAVE_IPV6 struct addrinfo req, *ai; - char hbuf[NI_MAXHOST]; int host_error; #else struct hostent *hp; @@ -378,19 +377,15 @@ int net_gethostbyaddr(IPADDR *ip, char **name) #ifdef HAVE_IPV6 memset(&req, 0, sizeof(struct addrinfo)); req.ai_socktype = SOCK_STREAM; + req.ai_flags = AI_CANONNAME; /* save error to host_error for later use */ host_error = getaddrinfo(ipname, NULL, &req, &ai); if (host_error != 0) return host_error; + *name = g_strdup(ai->ai_canonname); - if (getnameinfo(ai->ai_addr, ai->ai_addrlen, hbuf, - sizeof(hbuf), NULL, 0, 0)) - return 1; - - /*FIXME: how does this work? *name = g_strdup(ai->?);*/ freeaddrinfo(ai); - return 1; #else hp = gethostbyaddr(ipname, strlen(ipname), AF_INET); if (hp == NULL) return -1; |