# HG changeset patch # User Timo Sirainen # Date 1224968176 -10800 # Node ID 1bf3afdd64509a18bb9fa2c1403276f4883a9041 # Parent 672fd089a8f75ae764f4dcc847adab83acc6356b mbox: If mailbox isn't a valid mbox, don't try to sync it when closing. diff -r 672fd089a8f7 -r 1bf3afdd6450 src/lib-storage/index/mbox/mbox-file.c --- a/src/lib-storage/index/mbox/mbox-file.c Sat Oct 25 23:34:02 2008 +0300 +++ b/src/lib-storage/index/mbox/mbox-file.c Sat Oct 25 23:56:16 2008 +0300 @@ -172,6 +172,7 @@ 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"); diff -r 672fd089a8f7 -r 1bf3afdd6450 src/lib-storage/index/mbox/mbox-storage.c --- a/src/lib-storage/index/mbox/mbox-storage.c Sat Oct 25 23:34:02 2008 +0300 +++ b/src/lib-storage/index/mbox/mbox-storage.c Sat Oct 25 23:56:16 2008 +0300 @@ -786,7 +786,7 @@ 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; } diff -r 672fd089a8f7 -r 1bf3afdd6450 src/lib-storage/index/mbox/mbox-storage.h --- a/src/lib-storage/index/mbox/mbox-storage.h Sat Oct 25 23:34:02 2008 +0300 +++ b/src/lib-storage/index/mbox/mbox-storage.h Sat Oct 25 23:56:16 2008 +0300 @@ -42,6 +42,7 @@ 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; diff -r 672fd089a8f7 -r 1bf3afdd6450 src/lib-storage/index/mbox/mbox-sync.c --- a/src/lib-storage/index/mbox/mbox-sync.c Sat Oct 25 23:34:02 2008 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync.c Sat Oct 25 23:56:16 2008 +0300 @@ -808,6 +808,7 @@ 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");