aboutsummaryrefslogtreecommitdiffstats
path: root/bin/mailmanctl
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2010-02-15 10:59:20 -0800
committerMark Sapiro <mark@msapiro.net>2010-02-15 10:59:20 -0800
commit1e8dac6da00d176aa6cf10053e5a29c5c26b30f9 (patch)
tree6874d8249a71197b0fc92674af5502390c471107 /bin/mailmanctl
parent3e6b49ad2913680343cc4c27d86eb2c0c4bc6190 (diff)
downloadmailman2-1e8dac6da00d176aa6cf10053e5a29c5c26b30f9.tar.gz
mailman2-1e8dac6da00d176aa6cf10053e5a29c5c26b30f9.tar.xz
mailman2-1e8dac6da00d176aa6cf10053e5a29c5c26b30f9.zip
When daemonizing mailmanctl, we now ensure terminal files are closed.
Diffstat (limited to '')
-rw-r--r--bin/mailmanctl9
1 files changed, 8 insertions, 1 deletions
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