aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-04-07 07:31:17 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-04-07 07:32:44 +0200
commit0b9a046c1ae023268b2d9928ca4e3c884ae871b8 (patch)
treecde00f3db0dc99823d3edbcb1e8deea231da211d /src
parent65fa43bda19a8f41b808b1884c0bf5aefba18e7c (diff)
parent1a9a2cb7dcc60781a3cbca3a7846ff153143260c (diff)
downloadbitcoin-0b9a046c1ae023268b2d9928ca4e3c884ae871b8.tar.xz
Merge #21616: [0.21] build: link against -lsocket if required for *ifaddrs
1a9a2cb7dcc60781a3cbca3a7846ff153143260c net: add ifaddrs.h include (fanquake) f6896dfde73bb37f4f0f0f9bfe9855d4fe9e9fe5 build: check if -lsocket is required with *ifaddrs (fanquake) e99d6d0c7cbdbb23f966e50c045bbd525ba8daf0 rand: only try and use freeifaddrs if available (fanquake) Pull request description: Backports #21486 to the 0.21 branch. Related to #21485. ACKs for top commit: MarcoFalke: cherry-pick-only ACK 1a9a2cb7dcc60781a3cbca3a7846ff153143260c did not test or review 🚶 Tree-SHA512: 400dcf0f0bffa9b2c820403936b894969113a2bd82a32ae29d3fb73c4ef9ffafb55f5325fcc4929f6e685f8932be6f566f5dd2163ecf8a64b154b0c401109311
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp4
-rw-r--r--src/randomenv.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 1fd913eb64..15e52de94d 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -28,6 +28,10 @@
#include <fcntl.h>
#endif
+#if HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS
+#include <ifaddrs.h>
+#endif
+
#ifdef USE_POLL
#include <poll.h>
#endif
diff --git a/src/randomenv.cpp b/src/randomenv.cpp
index 07122b7f6d..79ab8daf6a 100644
--- a/src/randomenv.cpp
+++ b/src/randomenv.cpp
@@ -38,7 +38,7 @@
#include <sys/utsname.h>
#include <unistd.h>
#endif
-#if HAVE_DECL_GETIFADDRS
+#if HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS
#include <ifaddrs.h>
#endif
#if HAVE_SYSCTL
@@ -361,7 +361,7 @@ void RandAddStaticEnv(CSHA512& hasher)
hasher.Write((const unsigned char*)hname, strnlen(hname, 256));
}
-#if HAVE_DECL_GETIFADDRS
+#if HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS
// Network interfaces
struct ifaddrs *ifad = NULL;
getifaddrs(&ifad);