From 1e8dac6da00d176aa6cf10053e5a29c5c26b30f9 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Mon, 15 Feb 2010 10:59:20 -0800 Subject: When daemonizing mailmanctl, we now ensure terminal files are closed. --- bin/mailmanctl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/mailmanctl b/bin/mailmanctl index 473c9470..613f909f 100644 --- a/bin/mailmanctl +++ b/bin/mailmanctl @@ -1,6 +1,6 @@ #! @PYTHON@ -# Copyright (C) 2001-2006 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2010 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -417,6 +417,13 @@ def main(): # won't be opening any terminal devices, don't do the ultra-paranoid # suggestion of doing a second fork after the setsid() call. os.setsid() + + # Be sure to close any open std{in,out,err} + devnull = os.open('/dev/null', 0) + os.dup2(devnull, 0) + os.dup2(devnull, 1) + os.dup2(devnull, 2) + # Instead of cd'ing to root, cd to the Mailman installation home os.chdir(mm_cfg.PREFIX) # Set our file mode creation umask -- cgit v1.2.3