[dovecot-cvs] dovecot: If save failed, log also the reason for it.

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 12 21:22:06 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/d4b7a25c814c
changeset: 5710:d4b7a25c814c
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 12 21:21:59 2007 +0300
description:
If save failed, log also the reason for it.

diffstat:

1 file changed, 12 insertions(+), 5 deletions(-)
src/deliver/deliver.c |   17 ++++++++++++-----

diffs (34 lines):

diff -r c6cde7452a9f -r d4b7a25c814c src/deliver/deliver.c
--- a/src/deliver/deliver.c	Tue Jun 12 20:15:00 2007 +0300
+++ b/src/deliver/deliver.c	Tue Jun 12 21:21:59 2007 +0300
@@ -124,7 +124,7 @@ int deliver_save(struct mail_namespace *
 	struct mailbox *box;
 	struct mailbox_transaction_context *t;
 	struct mail_keywords *kw;
-	const char *msgid;
+	const char *msgid, *mailbox_name;
 	int ret = 0;
 
 	if (strcmp(mailbox, default_mailbox_name) == 0)
@@ -148,10 +148,17 @@ int deliver_save(struct mail_namespace *
 		ret = mailbox_transaction_commit(&t, 0);
 
 	msgid = mail_get_first_header(mail, "Message-ID");
-	i_info(ret < 0 ? "msgid=%s: save failed to %s" :
-	       "msgid=%s: saved mail to %s",
-	       msgid == NULL ? "" : str_sanitize(msgid, 80),
-	       str_sanitize(mailbox_get_name(box), 80));
+	msgid = msgid == NULL ? "" : str_sanitize(msgid, 80);
+	mailbox_name = str_sanitize(mailbox_get_name(box), 80);
+
+	if (ret == 0)
+		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));
+	}
 
 	mailbox_close(&box);
 	return ret;


More information about the dovecot-cvs mailing list