diff options
| author | bwarsaw | 2000-06-23 04:17:55 +0000 |
|---|---|---|
| committer | bwarsaw | 2000-06-23 04:17:55 +0000 |
| commit | 5e2b5624d90af5954fe85d01c03bf6166a093248 (patch) | |
| tree | f2ffc4e04f6e3d8450dfed938367b376418d8621 /Mailman/Handlers/ToUsenet.py | |
| parent | eb07c3e838bf7cfedba27f43086b407557b2fcfd (diff) | |
| download | mailman-5e2b5624d90af5954fe85d01c03bf6166a093248.tar.gz mailman-5e2b5624d90af5954fe85d01c03bf6166a093248.tar.zst mailman-5e2b5624d90af5954fe85d01c03bf6166a093248.zip | |
process(): Be extra paranoid about the forks and child processes.
Make absolutely sure that the child process exits without returning
control to the caller. If we complete successfully, we exit with
status 0. If any exception occurs we print a traceback and exit with
status 1.
Diffstat (limited to 'Mailman/Handlers/ToUsenet.py')
| -rw-r--r-- | Mailman/Handlers/ToUsenet.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Mailman/Handlers/ToUsenet.py b/Mailman/Handlers/ToUsenet.py index f0f88bedb..47de36d91 100644 --- a/Mailman/Handlers/ToUsenet.py +++ b/Mailman/Handlers/ToUsenet.py @@ -21,6 +21,7 @@ import os import string import re import socket +import traceback from Mailman import mm_cfg from Mailman.Logging.Syslog import syslog @@ -41,21 +42,25 @@ def process(mlist, msg, msgdata): if not mlist.nntp_host: error.append('no NNTP host') if error: - syslog('NNTP gateway improperly configured: ' + + syslog('error', 'NNTP gateway improperly configured: ' + string.join(error, ', ')) return # Fork in case the nntp connection hangs. pid = os.fork() if pid: - # In the parent. This is a bit of a kludge to keep a list of the - # children that need to be waited on. We want to be sure to do the - # waiting while the list is unlocked! + # In the parent. kids = msgdata.get('_kids', {}) kids[pid] = pid msgdata['_kids'] = kids - else: + return + # In the child + try: do_child(mlist, msg) - + os._exit(0) + except: + traceback.print_exc() + os._exit(1) + def do_child(mlist, msg): @@ -145,4 +150,3 @@ def do_child(mlist, msg): finally: if conn: conn.quit() - os._exit(0) |
