dovecot-1.2: mbox-snarf plugin: If copying failed due to out of ...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Dec 14 08:36:28 EET 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/e8a8383895df
changeset: 8553:e8a8383895df
user: Timo Sirainen <tss at iki.fi>
date: Sun Dec 14 08:36:10 2008 +0200
description:
mbox-snarf plugin: If copying failed due to out of disk space, don't rollback the entire move.
diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
src/plugins/mbox-snarf/mbox-snarf-plugin.c | 13 +++++++++----
diffs (31 lines):
diff -r adfe0b077dc7 -r e8a8383895df src/plugins/mbox-snarf/mbox-snarf-plugin.c
--- a/src/plugins/mbox-snarf/mbox-snarf-plugin.c Sun Dec 14 07:47:45 2008 +0200
+++ b/src/plugins/mbox-snarf/mbox-snarf-plugin.c Sun Dec 14 08:36:10 2008 +0200
@@ -41,6 +41,7 @@ static int mbox_snarf(struct mailbox *sr
struct mail_search_context *search_ctx;
struct mailbox_transaction_context *src_trans, *dest_trans;
struct mail *mail;
+ enum mail_error error;
int ret;
if (mailbox_sync(srcbox, MAILBOX_SYNC_FLAG_FULL_READ, 0, NULL) < 0)
@@ -61,11 +62,15 @@ static int mbox_snarf(struct mailbox *sr
if (mail->expunged)
continue;
- if (mailbox_copy(dest_trans, mail, 0, NULL, NULL) < 0) {
- if (!mail->expunged) {
+ if (mailbox_copy(dest_trans, mail, 0, NULL, NULL) < 0 &&
+ !mail->expunged) {
+ (void)mail_storage_get_last_error(destbox->storage,
+ &error);
+ /* if we failed because of out of disk space, just
+ move those messages we managed to move so far. */
+ if (error != MAIL_ERROR_NOSPACE)
ret = -1;
- break;
- }
+ break;
}
mail_expunge(mail);
}
More information about the dovecot-cvs
mailing list