dovecot: If we can't open/create the wanted mailbox, log an error.

dovecot at dovecot.org dovecot at dovecot.org
Mon Dec 3 18:53:12 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/2f7939f262ef
changeset: 6918:2f7939f262ef
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Dec 03 18:53:04 2007 +0200
description:
If we can't open/create the wanted mailbox, log an error.

diffstat:

1 file changed, 11 insertions(+), 9 deletions(-)
src/deliver/deliver.c |   20 +++++++++++---------

diffs (49 lines):

diff -r 751e773f50b2 -r 2f7939f262ef src/deliver/deliver.c
--- a/src/deliver/deliver.c	Mon Dec 03 16:11:32 2007 +0200
+++ b/src/deliver/deliver.c	Mon Dec 03 18:53:04 2007 +0200
@@ -122,15 +122,25 @@ int deliver_save(struct mail_namespace *
 	struct mailbox *box;
 	struct mailbox_transaction_context *t;
 	struct mail_keywords *kw;
+	enum mail_error error;
 	const char *msgid, *mailbox_name;
 	int ret = 0;
 
 	if (strcmp(mailbox, default_mailbox_name) == 0)
 		tried_default_save = TRUE;
 
+	if (mail_get_first_header(mail, "Message-ID", &msgid) <= 0)
+		msgid = "";
+	else
+		msgid = str_sanitize(msgid, 80);
+	mailbox_name = str_sanitize(mailbox, 80);
+
 	box = mailbox_open_or_create_synced(namespaces, storage_r, mailbox);
-	if (box == NULL)
+	if (box == NULL) {
+		i_info("msgid=%s: save failed to %s: %s", msgid, mailbox_name,
+		       mail_storage_get_last_error(*storage_r, &error));
 		return -1;
+	}
 
 	t = mailbox_transaction_begin(box, MAILBOX_TRANSACTION_FLAG_EXTERNAL);
 
@@ -145,18 +155,10 @@ int deliver_save(struct mail_namespace *
 	else
 		ret = mailbox_transaction_commit(&t);
 
-	if (mail_get_first_header(mail, "Message-ID", &msgid) <= 0)
-		msgid = "";
-	else
-		msgid = str_sanitize(msgid, 80);
-	mailbox_name = str_sanitize(mailbox_get_name(box), 80);
-
 	if (ret == 0) {
 		saved_mail = TRUE;
 		i_info("msgid=%s: saved mail to %s", msgid, mailbox_name);
 	} else {
-		enum mail_error error;
-
 		i_info("msgid=%s: save failed to %s: %s", msgid, mailbox_name,
 		       mail_storage_get_last_error(*storage_r, &error));
 	}


More information about the dovecot-cvs mailing list