From: <los...@us...> - 2009-12-15 22:58:02
|
Revision: 757 http://fail2ban.svn.sourceforge.net/fail2ban/?rev=757&view=rev Author: lostcontrol Date: 2009-12-15 22:57:54 +0000 (Tue, 15 Dec 2009) Log Message: ----------- - Patch to make log file descriptors cloexec to stop leaking file descriptors on fork/exec. Thanks to Jonathan Underwood. https://bugzilla.redhat.com/show_bug.cgi?id=230191#c24 Modified Paths: -------------- branches/FAIL2BAN-0_8/server/filter.py Modified: branches/FAIL2BAN-0_8/server/filter.py =================================================================== --- branches/FAIL2BAN-0_8/server/filter.py 2009-12-15 22:54:57 UTC (rev 756) +++ branches/FAIL2BAN-0_8/server/filter.py 2009-12-15 22:57:54 UTC (rev 757) @@ -31,7 +31,7 @@ from mytime import MyTime from failregex import FailRegex, Regex, RegexException -import logging, re, os +import logging, re, os, fcntl # Gets the instance of the logger. logSys = logging.getLogger("fail2ban.filter") @@ -469,6 +469,9 @@ def open(self): self.__handler = open(self.__filename) + # Set the file descriptor to be FD_CLOEXEC + fd = self.__handler.fileno() + fcntl.fcntl(fd, fcntl.F_SETFD, fd | fcntl.FD_CLOEXEC) firstLine = self.__handler.readline() # Computes the MD5 of the first line. myHash = md5.new(firstLine).digest() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |