]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: If mailbox isn't a valid mbox, don't try to sync it when closing.
authorTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2008 20:56:16 +0000 (23:56 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2008 20:56:16 +0000 (23:56 +0300)
--HG--
branch : HEAD

src/lib-storage/index/mbox/mbox-file.c
src/lib-storage/index/mbox/mbox-storage.c
src/lib-storage/index/mbox/mbox-storage.h
src/lib-storage/index/mbox/mbox-sync.c

index d5a0c448f90e96181b28862eb300fb45a69c7204..54ed986990dd11d8d2691676030b3b58be7ffd0d 100644 (file)
@@ -172,6 +172,7 @@ int mbox_file_seek(struct mbox_mailbox *mbox, struct mail_index_view *view,
 
        if (istream_raw_mbox_seek(mbox->mbox_stream, offset) < 0) {
                if (offset == 0) {
+                       mbox->invalid_mbox_file = TRUE;
                        mail_storage_set_error(&mbox->storage->storage,
                                MAIL_ERROR_NOTPOSSIBLE,
                                "Mailbox isn't a valid mbox file");
index 48d72da757b83e7f5c5605c14f017a13c74e3526..48bf5f32e4cad026a6ab97cfdf1adff94cc26014 100644 (file)
@@ -786,7 +786,7 @@ static int mbox_storage_mailbox_close(struct mailbox *box)
                        sync_flags |= MBOX_SYNC_REWRITE;
                }
        }
-       if (sync_flags != 0) {
+       if (sync_flags != 0 && !mbox->invalid_mbox_file) {
                if (mbox_sync(mbox, sync_flags) < 0)
                        ret = -1;
        }
index c154de0a63fbf1ec455e4a21d34c442af70ed2f9..cd0ae80eab7f13544f884998019cd562afda71e3 100644 (file)
@@ -42,6 +42,7 @@ struct mbox_mailbox {
        uint32_t mbox_ext_idx;
 
        unsigned int no_mbox_file:1;
+       unsigned int invalid_mbox_file:1;
        unsigned int mbox_sync_dirty:1;
        unsigned int mbox_do_dirty_syncs:1;
        unsigned int mbox_very_dirty_syncs:1;
index f4711f2d1ee8d3e91b2bf1fc20ae33a301c7438b..55feed8535c3c8896b82a1bae6c0f1f3227b2395 100644 (file)
@@ -808,6 +808,7 @@ mbox_sync_seek_to_seq(struct mbox_sync_context *sync_ctx, uint32_t seq)
 
        if (seq == 0) {
                if (istream_raw_mbox_seek(mbox->mbox_stream, 0) < 0) {
+                       mbox->invalid_mbox_file = TRUE;
                        mail_storage_set_error(&mbox->storage->storage,
                                MAIL_ERROR_NOTPOSSIBLE,
                                "Mailbox isn't a valid mbox file");