comparison src/lib-storage/index/maildir/maildir-sync.c @ 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 bf4e98a0de3f
children 615b7738a62f
comparison
equal deleted inserted replaced
4611:287178dedc27 4612:2c033ffc8f6f
902 } 902 }
903 } 903 }
904 if (ret < 0) 904 if (ret < 0)
905 mail_index_sync_rollback(&sync_ctx->sync_ctx); 905 mail_index_sync_rollback(&sync_ctx->sync_ctx);
906 else { 906 else {
907 /* Set syncing_commit=TRUE so that if any sync callbacks try
908 to access mails which got lost (eg. expunge callback trying
909 to open the file which was just unlinked) we don't try to
910 start a second index sync and crash. */
911 mbox->syncing_commit = TRUE;
907 if (mail_index_sync_commit(&sync_ctx->sync_ctx) < 0) 912 if (mail_index_sync_commit(&sync_ctx->sync_ctx) < 0)
908 ret = -1; 913 ret = -1;
909 else { 914 else {
910 mbox->ibox.commit_log_file_seq = 0; 915 mbox->ibox.commit_log_file_seq = 0;
911 mbox->ibox.commit_log_file_offset = 0; 916 mbox->ibox.commit_log_file_offset = 0;
912 } 917 }
918 mbox->syncing_commit = FALSE;
913 } 919 }
914 920
915 if (ret < 0) 921 if (ret < 0)
916 mail_storage_set_index_error(&mbox->ibox); 922 mail_storage_set_index_error(&mbox->ibox);
917 923