changeset 4612:2c033ffc8f6f HEAD

maildir_storage_sync_force() crashed if called from mail index sync/expunge callbacks.
author Timo Sirainen <tss@iki.fi>
date Sun, 17 Sep 2006 20:28:36 +0300
parents 287178dedc27
children 84ee1092021f
files src/lib-storage/index/maildir/maildir-sync.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-sync.c	Sun Sep 17 20:12:35 2006 +0300
+++ b/src/lib-storage/index/maildir/maildir-sync.c	Sun Sep 17 20:28:36 2006 +0300
@@ -904,12 +904,18 @@
 	if (ret < 0)
 		mail_index_sync_rollback(&sync_ctx->sync_ctx);
 	else {
+		/* Set syncing_commit=TRUE so that if any sync callbacks try
+		   to access mails which got lost (eg. expunge callback trying
+		   to open the file which was just unlinked) we don't try to
+		   start a second index sync and crash. */
+		mbox->syncing_commit = TRUE;
 		if (mail_index_sync_commit(&sync_ctx->sync_ctx) < 0)
 			ret = -1;
 		else {
 			mbox->ibox.commit_log_file_seq = 0;
 			mbox->ibox.commit_log_file_offset = 0;
 		}
+		mbox->syncing_commit = FALSE;
 	}
 
 	if (ret < 0)