From 23fda4db6d1bb400a97f6d2a07d9b700f9546129 Mon Sep 17 00:00:00 2001 From: Sven-Haegar Koch Date: Sun, 17 May 2015 05:29:21 +0200 Subject: [PATCH] Let sockaddr2hostname() handle AF_UNSPEC addresses. --- src/netutl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/netutl.c b/src/netutl.c index 701a430..2eebb64 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -121,7 +121,10 @@ char *sockaddr2hostname(const sockaddr_t *sa) { char port[NI_MAXSERV] = "unknown"; int err; - if(sa->sa.sa_family == AF_UNKNOWN) { + if(sa->sa.sa_family == AF_UNSPEC) { + xasprintf(&str, "unspec port unspec"); + return str; + } else if(sa->sa.sa_family == AF_UNKNOWN) { xasprintf(&str, "%s port %s", sa->unknown.address, sa->unknown.port); return str; } -- 2.25.1