]> git.meshlink.io Git - meshlink/commitdiff
Fix android (Android 6 or before) compilation issue around getifaddr
authorRoop <40358733+sairoop-elear@users.noreply.github.com>
Fri, 7 Feb 2020 05:31:45 +0000 (11:01 +0530)
committerGuus Sliepen <guus@meshlink.io>
Sat, 8 Feb 2020 13:59:10 +0000 (14:59 +0100)
configure.ac
src/net.c

index 4028613f31868e26ea559636126b2dde8c9493f5..00e47faef27556743a4721e0a27fe2135c1a2fab 100644 (file)
@@ -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
 
 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"]
 )
 
   [], [], [#include "$srcdir/src/have.h"]
 )
 
index 7c600534e3a682488200bbfa9f4cf320e7fe11f3..95790ac1d287c84ed4f11e8cd19019288b2549b3 100644 (file)
--- 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
        struct ifaddrs *ifa = NULL;
        getifaddrs(&ifa);
 #endif
@@ -655,7 +655,7 @@ void retry(meshlink_handle_t *mesh) {
                        c->last_ping_time = 0;
                }
 
                        c->last_ping_time = 0;
                }
 
-#ifdef HAVE_IFADDRS_H
+#if defined(HAVE_IFADDRS_H) && defined(HAVE_GETIFADDRS) && defined(HAVE_FREEIFADDRS)
 
                if(!ifa) {
                        continue;
 
                if(!ifa) {
                        continue;
@@ -686,7 +686,7 @@ void retry(meshlink_handle_t *mesh) {
 #endif
        }
 
 #endif
        }
 
-#ifdef HAVE_IFADDRS_H
+#if defined(HAVE_IFADDRS_H) && defined(HAVE_GETIFADDRS) && defined(HAVE_FREEIFADDRS)
 
        if(ifa) {
                freeifaddrs(ifa);
 
        if(ifa) {
                freeifaddrs(ifa);