[libvirt] [PATCH] network: avoid including sys/sysctl.h on Linux

Daniel P. Berrangé berrange at redhat.com
Wed Jun 26 13:38:49 UTC 2019


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 at redhat.com>
---

Pushed as build fix for Fedora rawhide

src/network/bridge_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 465487432e..19faf7d514 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -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
 
-- 
2.21.0




More information about the libvir-list mailing list