X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/f3ebb786e451da973560f1c9d8cdb151d25108b5..dd19ce4f24eec64177cdcfcf294b8efbb631a24b:/src/src/os.c diff --git a/src/src/os.c b/src/src/os.c index c44bd3e99..2bb5bbef1 100644 --- a/src/src/os.c +++ b/src/src/os.c @@ -3,6 +3,7 @@ *************************************************/ /* Copyright (c) University of Cambridge 1995 - 2018 */ +/* Copyright (c) The Exim Maintainers 2021 */ /* See the file NOTICE for conditions of use and distribution. */ #ifdef STAND_ALONE @@ -495,9 +496,11 @@ if (getifaddrs(&ifalist) != 0) for (struct ifaddrs * ifa = ifalist; ifa; ifa = ifa->ifa_next) { - if (ifa->ifa_addr->sa_family != AF_INET + struct sockaddr * ifa_addr = ifa->ifa_addr; + if (!ifa_addr) continue; + if (ifa_addr->sa_family != AF_INET #if HAVE_IPV6 - && ifa->ifa_addr->sa_family != AF_INET6 + && ifa_addr->sa_family != AF_INET6 #endif /* HAVE_IPV6 */ ) continue; @@ -511,9 +514,9 @@ for (struct ifaddrs * ifa = ifalist; ifa; ifa = ifa->ifa_next) next = store_get(sizeof(ip_address_item), FALSE); next->next = NULL; next->port = 0; - (void)host_ntoa(-1, ifa->ifa_addr, next->address, NULL); + (void)host_ntoa(-1, ifa_addr, next->address, NULL); - if (yield == NULL) + if (!yield) yield = last = next; else { @@ -831,7 +834,7 @@ return type. res_state os_get_dns_resolver_res(void) { - return &_res; +return &_res; } #endif /* OS_GET_DNS_RESOLVER_RES */