summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorvenaas <venaas>2008-02-21 14:40:43 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-02-21 14:40:43 +0000
commit1b147faa3975dc259abb2fc8c8d398ed44c4b01f (patch)
treed9bf7b8c340ee67ddf09d41156b9c1fe316be9ea /util.c
parent1932be8fffa9c6a1e3b6df17f51f3e29746cb7f4 (diff)
Solaris9 fix
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@216 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util.c b/util.c
index ee7d4d5..a9ccdde 100644
--- a/util.c
+++ b/util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007 Stig Venaas <venaas@uninett.no>
+ * Copyright (C) 2006-2008 Stig Venaas <venaas@uninett.no>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -88,10 +88,12 @@ char *addr2string(struct sockaddr *addr, socklen_t len) {
addr = (struct sockaddr *)&sa4;
}
}
+ len = addr->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
+
if (getnameinfo(addr, len, addr_buf[i], sizeof(addr_buf[i]),
NULL, 0, NI_NUMERICHOST)) {
debug(DBG_WARN, "getnameinfo failed");
- return return "getnameinfo_failed";
+ return "getnameinfo_failed";
}
return addr_buf[i];
}