]> xenbits.xensource.com Git - libvirt.git/commitdiff
network: avoid including sys/sysctl.h on Linux
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 26 Jun 2019 13:34:20 +0000 (14:34 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 26 Jun 2019 13:36:11 +0000 (14:36 +0100)
The sys/sysctl.h header is only needed on BSD platforms to get
the sysctlbyname() function declaration. On Linux we talk to
procfs instead to change sysctls.

Unfortunately a legacy sys/sysctl.h header does exist on Linux
and including it has recently started triggering a deprecation
warning from glibc.

Protect its inclusion with a HAVE_SYSCTLBYNAME check instead
so that it only gets used on platforms where we need that
function declaration.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/network/bridge_driver.c

index 465487432eb061092baa023a0729b8ee6cd7d90e..19faf7d51482fa78ebce65172fa7d1de74ec7d1c 100644 (file)
@@ -33,7 +33,7 @@
 #include <sys/wait.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
-#if HAVE_SYS_SYSCTL_H
+#ifdef HAVE_SYSCTLBYNAME
 # include <sys/sysctl.h>
 #endif