From: Roy Marples Date: Sun, 10 May 2009 20:20:18 +0000 (+0000) Subject: Some glibc versions have a NULL ifa_addr for the ifa from getifaddrs(3). X-Git-Tag: v5.0.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53814ee2e868f24dd1c5676fafb9af01f17bea10;p=thirdparty%2Fdhcpcd.git Some glibc versions have a NULL ifa_addr for the ifa from getifaddrs(3). --- diff --git a/net.c b/net.c index a52901ed..77cd5fdd 100644 --- a/net.c +++ b/net.c @@ -272,6 +272,8 @@ discover_interfaces(int argc, char * const *argv) ifs = ifl = NULL; for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) { + if (ifa->ifa_addr == NULL) /* should not happen */ + continue; #ifdef AF_LINK if (ifa->ifa_addr->sa_family != AF_LINK) continue; @@ -372,6 +374,8 @@ do_address(const char *ifname, retval = 0; for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) { + if (ifa->ifa_addr == NULL) /* should not happen */ + continue; if (ifa->ifa_addr->sa_family != AF_INET || strcmp(ifa->ifa_name, ifname) != 0) continue;