From eecfeadeb4fc70ee002b81c20ba12ba3e3acb843 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 16 May 2015 02:01:54 +0200 Subject: [PATCH] Let sockaddr2str() handle AF_UNSPEC addresses. --- src/netutl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/netutl.c b/src/netutl.c index bff734e..701a430 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -83,7 +83,13 @@ void sockaddr2str(const sockaddr_t *sa, char **addrstr, char **portstr) { char *scopeid; int err; - if(sa->sa.sa_family == AF_UNKNOWN) { + if(sa->sa.sa_family == AF_UNSPEC) { + if(addrstr) + *addrstr = xstrdup("unspec"); + if(portstr) + *portstr = xstrdup("unspec"); + return; + } else if(sa->sa.sa_family == AF_UNKNOWN) { if(addrstr) *addrstr = xstrdup(sa->unknown.address); if(portstr) -- 2.25.1