From 700ce9918794b4e8d5546b0b503693c5f2d31e83 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Tue, 30 Oct 2012 12:09:23 +0100 Subject: [PATCH] Close all sockets before fork() --- src/networkpluginserver.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/networkpluginserver.cpp b/src/networkpluginserver.cpp index 51c4aded..28275c63 100644 --- a/src/networkpluginserver.cpp +++ b/src/networkpluginserver.cpp @@ -185,6 +185,11 @@ static unsigned long exec_(const std::string& exePath, const char *host, const c pid_t pid = fork(); if ( pid == 0 ) { setsid(); + // close all files + int maxfd=sysconf(_SC_OPEN_MAX); + for(int fd=3; fd