[dovecot-cvs] dovecot-1.0: If save failed, log also the reason for it.
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jun 12 21:22:03 EEST 2007
details: http://hg.dovecot.org/dovecot-1.0/rev/abc4be10176e
changeset: 5304:abc4be10176e
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 0d3d7083b582 -r abc4be10176e src/deliver/deliver.c
--- a/src/deliver/deliver.c Tue Jun 12 20:17:29 2007 +0300
+++ b/src/deliver/deliver.c Tue Jun 12 21:21:59 2007 +0300
@@ -115,7 +115,7 @@ int deliver_save(struct mail_storage *st
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)
@@ -139,10 +139,17 @@ int deliver_save(struct mail_storage *st
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 {
+ bool syntax, temp;
+
+ i_info("msgid=%s: save failed to %s: %s", msgid, mailbox_name,
+ mail_storage_get_last_error(storage, &syntax, &temp));
+ }
mailbox_close(&box);
return ret;
More information about the dovecot-cvs
mailing list