changeset 8340:1bf3afdd6450 HEAD

mbox: If mailbox isn't a valid mbox, don't try to sync it when closing.
author Timo Sirainen <tss@iki.fi>
date Sat, 25 Oct 2008 23:56:16 +0300
parents 672fd089a8f7
children fa564d405f51
files 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
diffstat 4 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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");
--- 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;
 	}
--- 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;
--- 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");