From 242ba8893bef1fe05d71959afc5273af021b8537 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Tue, 6 Nov 2012 20:09:35 +0100 Subject: FreeBSD compile fixes - Only Linux have MADV_DONTFORK, so make it Linux specific - Added a few missing include files which Linux included through their include chains Signed-off-by: David Sommerseth --- plugin/CMakeLists.txt | 4 ++++ plugin/firewall/eurephiafw.c | 3 +++ plugin/firewall/eurephiafw_helpers.c | 1 + 3 files changed, 8 insertions(+) (limited to 'plugin') diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt index db8384c..0a52bd6 100644 --- a/plugin/CMakeLists.txt +++ b/plugin/CMakeLists.txt @@ -82,6 +82,10 @@ IF(ENABLE_EUREPHIADM) REMOVE_DEFINITIONS(-DENABLE_EUREPHIADM) ENDIF(ENABLE_EUREPHIADM) +# Only allow MADV_DONTFORK on Linux +IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + SET(COMPILE_DEFINITIONS HAVE_MADVDONTFORK) +ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") # Build rule for eurephia-auth.so ADD_LIBRARY(eurephia-auth MODULE diff --git a/plugin/firewall/eurephiafw.c b/plugin/firewall/eurephiafw.c index 6b2bf24..d74a383 100644 --- a/plugin/firewall/eurephiafw.c +++ b/plugin/firewall/eurephiafw.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -236,8 +237,10 @@ void eFW_StartFirewall(eurephiaCTX *ctx, const int daemon, const int logredir) { return; } +#if HAVE_MADVDONTFORK // Make sure that these variables are not available in the child madvise(ctx, sizeof(eurephiaCTX), MADV_DONTFORK); +#endif // Start a new process (should run with root permissions) - which will do the firewall work if( (ctx->fwcfg->fwproc_pid = fork()) < 0 ) { diff --git a/plugin/firewall/eurephiafw_helpers.c b/plugin/firewall/eurephiafw_helpers.c index 728e507..b779925 100644 --- a/plugin/firewall/eurephiafw_helpers.c +++ b/plugin/firewall/eurephiafw_helpers.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include -- cgit