diff options
author | Ricard Wanderlof <ricard.wanderlof@axis.com> | 2008-06-27 15:29:48 +0000 |
---|---|---|
committer | Ricard Wanderlof <ricard.wanderlof@axis.com> | 2008-06-27 15:29:48 +0000 |
commit | f2f6143a40186b4998559c76b71aef3d04459a63 (patch) | |
tree | 50139d4f9a43f7876b03d0d36287cd3b7f7b4667 /libc/inet | |
parent | 6c1d86dcdb30f52d7f64179b982b253f1ba6951c (diff) |
Fixed #if -> #if defined.
Take __UCLIBC_HAS_IPV4__ into account.
Diffstat (limited to 'libc/inet')
-rw-r--r-- | libc/inet/check_pf.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/libc/inet/check_pf.c b/libc/inet/check_pf.c index b6c93783a..9eed516b7 100644 --- a/libc/inet/check_pf.c +++ b/libc/inet/check_pf.c @@ -18,7 +18,7 @@ 02111-1307 USA. */ #include <features.h> -#include <ifaddrs.h> +#include "ifaddrs.h" #include <netdb.h> @@ -28,7 +28,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6) { *seen_ipv4 = false; *seen_ipv6 = false; -#if __UCLIBC_SUPPORT_AI_ADDRCONFIG__ +#if defined __UCLIBC_SUPPORT_AI_ADDRCONFIG__ { /* Get the interface list via getifaddrs. */ struct ifaddrs *ifa = NULL; @@ -37,18 +37,25 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6) { /* We cannot determine what interfaces are available. Be optimistic. */ +#if defined __UCLIBC_HAS_IPV4__ *seen_ipv4 = true; -#if __UCLIBC_HAS_IPV6__ +#endif /* __UCLIBC_HAS_IPV4__ */ +#if defined __UCLIBC_HAS_IPV6__ *seen_ipv6 = true; #endif /* __UCLIBC_HAS_IPV6__ */ return; } for (runp = ifa; runp != NULL; runp = runp->ifa_next) +#if defined __UCLIBC_HAS_IPV4__ if (runp->ifa_addr->sa_family == PF_INET) *seen_ipv4 = true; -#if __UCLIBC_HAS_IPV6__ - else if (runp->ifa_addr->sa_family == PF_INET6) +#endif /* __UCLIBC_HAS_IPV4__ */ +#if defined __UCLIBC_HAS_IPV4__ && defined __UCLIBC_HAS_IPV6__ + else /* can't be both at once */ +#endif /* __UCLIBC_HAS_IPV4__ && defined __UCLIBC_HAS_IPV6__ */ +#if defined __UCLIBC_HAS_IPV6__ + if (runp->ifa_addr->sa_family == PF_INET6) *seen_ipv6 = true; #endif /* __UCLIBC_HAS_IPV6__ */ @@ -56,8 +63,10 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6) } #else /* AI_ADDRCONFIG is disabled, assume both ipv4 and ipv6 available. */ +#if defined __UCLIBC_HAS_IPV4__ *seen_ipv4 = true; -#if __UCLIBC_HAS_IPV6__ +#endif /* __UCLIBC_HAS_IPV4__ */ +#if defined __UCLIBC_HAS_IPV6__ *seen_ipv6 = true; #endif /* __UCLIBC_HAS_IPV6__ */ |