From 81085f102207cdc3bca81078a92f527ba109a302 Mon Sep 17 00:00:00 2001 From: Jacek Masiulaniec Date: Wed, 2 Sep 2009 11:11:11 +0000 Subject: Do not lose mail when write(2) to mbox fails. --- usr.sbin/smtpd/mda.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c index 3c4a0492d75..84ebe5821af 100644 --- a/usr.sbin/smtpd/mda.c +++ b/usr.sbin/smtpd/mda.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mda.c,v 1.24 2009/08/06 13:40:45 gilles Exp $ */ +/* $OpenBSD: mda.c,v 1.25 2009/09/02 11:11:10 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -158,6 +158,9 @@ mda_dispatch_parent(int sig, short event, void *p) imsg_compose_event(env->sc_ievs[PROC_PARENT], IMSG_PARENT_MAILBOX_RENAME, 0, 0, -1, batchp, sizeof(struct batch)); + } else { + /* XXX: remove junk from tmp/ in mdir case */ + messagep->status |= S_MESSAGE_TEMPFAILURE; } if (s->mboxfd != -1) @@ -435,8 +438,8 @@ mda_remove_message(struct smtpd *env, struct batch *batchp, struct message *mess imsg_compose_event(env->sc_ievs[PROC_QUEUE], IMSG_QUEUE_MESSAGE_UPDATE, 0, 0, -1, messagep, sizeof (struct message)); - if ((batchp->message.status & S_MESSAGE_TEMPFAILURE) == 0 && - (batchp->message.status & S_MESSAGE_PERMFAILURE) == 0) { + if ((messagep->status & S_MESSAGE_TEMPFAILURE) == 0 && + (messagep->status & S_MESSAGE_PERMFAILURE) == 0) { log_info("%s: to=<%s@%s>, delay=%d, stat=Sent", messagep->message_uid, messagep->recipient.user, -- cgit v1.2.3