dovecot-1.2: mbox: If mailbox isn't a valid mbox, don't try to s...

dovecot at dovecot.org dovecot at dovecot.org
Sat Oct 25 23:56:20 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/1bf3afdd6450
changeset: 8340:1bf3afdd6450
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Oct 25 23:56:16 2008 +0300
description:
mbox: If mailbox isn't a valid mbox, don't try to sync it when closing.

diffstat:

4 files changed, 4 insertions(+), 1 deletion(-)
src/lib-storage/index/mbox/mbox-file.c    |    1 +
src/lib-storage/index/mbox/mbox-storage.c |    2 +-
src/lib-storage/index/mbox/mbox-storage.h |    1 +
src/lib-storage/index/mbox/mbox-sync.c    |    1 +

diffs (45 lines):

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 @@ int mbox_file_seek(struct mbox_mailbox *
 
 	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 @@ static int mbox_storage_mailbox_close(st
 			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 @@ 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;
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 @@ mbox_sync_seek_to_seq(struct mbox_sync_c
 
 	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");


More information about the dovecot-cvs mailing list