summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iface.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/iface.c b/iface.c
index 8c77c61..b069532 100644
--- a/iface.c
+++ b/iface.c
@@ -18,6 +18,7 @@
#include <assert.h>
#include <errno.h>
+#include <netdb.h>
#include <pthread.h>
#include <stdint.h>
#include <string.h>
@@ -143,8 +144,10 @@ static void iface_record_addr_del(struct iface_record *rec, struct sockaddr_stor
rec->addrs = addrs;
rec->size--;
} else {
- char as[INET6_ADDRSTRLEN];
- inet_ntop(addr->ss_family, addr + sizeof(addr->ss_family), as, sizeof(as));
+ char as[NI_MAXHOST];
+ if (getnameinfo((struct sockaddr *)addr, sizeof(*addr),
+ as, sizeof(as), NULL, 0, NI_NUMERICHOST))
+ strncpy(as, "<unknown>", sizeof(as) - 1);
log_err("Address %s to delete not found in records\n", as);
}
} else if (rec->size == 1) {