summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-09-02 11:11:11 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-09-02 11:11:11 +0000
commit81085f102207cdc3bca81078a92f527ba109a302 (patch)
treec1cf0ba430d644d096ab220e96b39a362d9c8a9c
parent00db09ae51f2b02b4dd671f59cd794e50de8946c (diff)
Do not lose mail when write(2) to mbox fails.
-rw-r--r--usr.sbin/smtpd/mda.c9
1 files 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 <gilles@openbsd.org>
@@ -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,