summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2012-11-06 20:09:35 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2012-11-06 20:17:26 +0100
commit242ba8893bef1fe05d71959afc5273af021b8537 (patch)
treecfd0ba7a8fc3bf4e0cf420f420e953a011c53f1d /plugin
parent7f791662efeea219395c79b45f1dc1465ddedd62 (diff)
downloadeurephia-242ba8893bef1fe05d71959afc5273af021b8537.tar.gz
eurephia-242ba8893bef1fe05d71959afc5273af021b8537.tar.xz
eurephia-242ba8893bef1fe05d71959afc5273af021b8537.zip
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 <dazo@users.sourceforge.net>
Diffstat (limited to 'plugin')
-rw-r--r--plugin/CMakeLists.txt4
-rw-r--r--plugin/firewall/eurephiafw.c3
-rw-r--r--plugin/firewall/eurephiafw_helpers.c1
3 files changed, 8 insertions, 0 deletions
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 <unistd.h>
#include <sys/mman.h>
#include <sys/wait.h>
+#include <signal.h>
#include <time.h>
#include <errno.h>
#include <assert.h>
@@ -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 <string.h>
#include <errno.h>
#include <unistd.h>
+#include <fcntl.h>
#include <semaphore.h>
#include <mqueue.h>