Mercurial > dovecot > original-hg > dovecot-1.2
diff src/plugins/mbox-snarf/mbox-snarf-plugin.c @ 8553:e8a8383895df HEAD
mbox-snarf plugin: If copying failed due to out of disk space, don't rollback the entire move.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 14 Dec 2008 08:36:10 +0200 |
parents | d4eab639c253 |
children | b9faf4db2a9f |
line wrap: on
line diff
--- 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 @@ 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 @@ 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); }