summaryrefslogtreecommitdiff
path: root/zwgc
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@1ts.org>2011-02-21 20:37:57 +0000
committerGravatar Karl Ramm <kcr@1ts.org>2011-02-21 20:37:57 +0000
commit1902b602b65ebe6d2f04e0847218015d48314727 (patch)
tree237e2434452e29dbfcdabe9e9d3623c1f685f04e /zwgc
parent7bfc14b4ef46cb1f0286dfc5bafcf0d39d680401 (diff)
Some getnameinfos (notably FreeBSD's) are pickier about the length.
Fixes #58
Diffstat (limited to 'zwgc')
-rw-r--r--zwgc/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/zwgc/main.c b/zwgc/main.c
index 5335678..7383f09 100644
--- a/zwgc/main.c
+++ b/zwgc/main.c
@@ -416,7 +416,11 @@ notice_handler(ZNotice_t *notice)
notice_callback, notice);
#else
ret = getnameinfo((const struct sockaddr *)&(notice->z_sender_sockaddr),
- sizeof(notice->z_sender_sockaddr),
+ notice->z_sender_sockaddr.sa.sa_family == AF_INET ?
+ sizeof(struct sockaddr_in) :
+ notice->z_sender_sockaddr.sa.sa_family == AF_INET6 ?
+ sizeof(struct sockaddr_in6) :
+ sizeof(notice->z_sender_sockaddr),
node, sizeof(node), NULL, 0, 0);
if (ret != 0)
strcpy(node, "?");