miniupnpd/getifaddr.c: fix when IPV6 is not enabled

This commit is contained in:
Thomas Bernard 2014-05-06 15:15:07 +02:00
parent 338a533a09
commit 98109ea92e
1 changed files with 2 additions and 0 deletions

View File

@ -198,6 +198,8 @@ int getifaddr_in6(const char * ifname, int af, struct in6_addr * addr)
#else /* defined(ENABLE_IPV6) || defined(USE_GETIFADDRS) */ #else /* defined(ENABLE_IPV6) || defined(USE_GETIFADDRS) */
/* IPv4 only */ /* IPv4 only */
struct in_addr addr4; struct in_addr addr4;
if(af != AF_INET)
return -1;
if(getifaddr(ifname, NULL, 0, &addr4, NULL) < 0) if(getifaddr(ifname, NULL, 0, &addr4, NULL) < 0)
return -1; return -1;
/* IPv4-mapped IPv6 address ::ffff:1.2.3.4 */ /* IPv4-mapped IPv6 address ::ffff:1.2.3.4 */