From: Roop <40358733+sairoop-elear@users.noreply.github.com> Date: Fri, 7 Feb 2020 05:31:45 +0000 (+0530) Subject: Fix android (Android 6 or before) compilation issue around getifaddr X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=9f8ed2802da6b48cb71377da84a83db04d3530b8;p=meshlink Fix android (Android 6 or before) compilation issue around getifaddr --- diff --git a/configure.ac b/configure.ac index 4028613f..00e47fae 100644 --- a/configure.ac +++ b/configure.ac @@ -134,7 +134,7 @@ AC_CHECK_TYPES([struct sockaddr_storage], ,AC_MSG_ERROR([System must support str dnl Checks for library functions. AC_TYPE_SIGNAL -AC_CHECK_FUNCS([asprintf fchmod fork gettimeofday random select setns strdup usleep getifaddrs], +AC_CHECK_FUNCS([asprintf fchmod fork gettimeofday random select setns strdup usleep getifaddrs freeifaddrs], [], [], [#include "$srcdir/src/have.h"] ) diff --git a/src/net.c b/src/net.c index 7c600534..95790ac1 100644 --- a/src/net.c +++ b/src/net.c @@ -639,7 +639,7 @@ void retry(meshlink_handle_t *mesh) { }); } -#ifdef HAVE_IFADDRS_H +#if defined(HAVE_IFADDRS_H) && defined(HAVE_GETIFADDRS) && defined(HAVE_FREEIFADDRS) struct ifaddrs *ifa = NULL; getifaddrs(&ifa); #endif @@ -655,7 +655,7 @@ void retry(meshlink_handle_t *mesh) { c->last_ping_time = 0; } -#ifdef HAVE_IFADDRS_H +#if defined(HAVE_IFADDRS_H) && defined(HAVE_GETIFADDRS) && defined(HAVE_FREEIFADDRS) if(!ifa) { continue; @@ -686,7 +686,7 @@ void retry(meshlink_handle_t *mesh) { #endif } -#ifdef HAVE_IFADDRS_H +#if defined(HAVE_IFADDRS_H) && defined(HAVE_GETIFADDRS) && defined(HAVE_FREEIFADDRS) if(ifa) { freeifaddrs(ifa);