remail/remaild: Fix failure message

While handling an exception in process_msg() the handler triggers another
one by trying to print a undefined variable (mailfile).

Hand the mailfile name into the function. Use 'pipe input' for pipe mode.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Thomas Gleixner 2020-09-03 22:04:44 +02:00
parent 7d69dec9ae
commit 43a0b5cb47

View file

@ -184,7 +184,7 @@ class remaild(object):
except: except:
pass pass
def process_msg(self, msg): def process_msg(self, msg, mailfile):
# Check whether one of the lists will take it # Check whether one of the lists will take it
for ml in self.mailinglists: for ml in self.mailinglists:
if not ml.enabled: if not ml.enabled:
@ -220,7 +220,7 @@ class remaild(object):
self.move_frozen(mailfile) self.move_frozen(mailfile)
continue continue
res = self.process_msg(msg) res = self.process_msg(msg, mailfile)
if res == 0: if res == 0:
os.unlink(mailfile) os.unlink(mailfile)
@ -379,7 +379,7 @@ class remaild(object):
policy = EmailPolicy(utf8=True) policy = EmailPolicy(utf8=True)
msg = message_from_file(sys.stdin, policy=policy) msg = message_from_file(sys.stdin, policy=policy)
return self.process_msg(msg) return self.process_msg(msg, 'pipe input')
# The runner # The runner
def run(self): def run(self):