mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Mark all FDs as close-on-exec
This marks all FDs which are valid after the function creating them returns as close-on-exec, so that processes started from ZNC (e.g. through the shell module) don't inherit a copy of all of our FDs. Csocket already does this for its FDs. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1004 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "FileUtils.h"
|
||||
#include "Utils.h"
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -251,6 +252,9 @@ bool CFile::Open(int iFlags, mode_t iMode) {
|
||||
if (m_iFD < 0)
|
||||
return false;
|
||||
|
||||
/* Make sure this FD isn't given to childs */
|
||||
SetFdCloseOnExec(m_iFD);
|
||||
|
||||
m_bClose = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user