# HG changeset patch # User Timo Sirainen # Date 1032239962 -10800 # Node ID a4eb58705351abee4d7ab86bb5c68d6345a2c5a5 # Parent 7cb03d43a0eaef9747861ca3a5fac0123cf92eb7 FSCK flag is removed at set_lock(), so it can't be directly set anywhere.. but using index->set_flags |= FSCK now keeps it. fixes mbox problems after flag changes. diff -r 7cb03d43a0ea -r a4eb58705351 src/lib-index/mail-index.c --- a/src/lib-index/mail-index.c Tue Sep 17 08:17:10 2002 +0300 +++ b/src/lib-index/mail-index.c Tue Sep 17 08:19:22 2002 +0300 @@ -361,6 +361,8 @@ int mail_index_set_lock(MailIndex *index, MailLockType lock_type) { + int keep_fsck; + if (index->lock_type == lock_type) return TRUE; @@ -373,10 +375,11 @@ if (index->lock_type == MAIL_LOCK_EXCLUSIVE) { /* dropping exclusive lock (either unlock or to shared) */ + keep_fsck = (index->set_flags & MAIL_INDEX_FLAG_FSCK) != 0; mail_index_update_header_changes(index); /* remove the FSCK flag only after successful fsync() */ - if (mail_index_sync_file(index)) { + if (mail_index_sync_file(index) && !keep_fsck) { index->header->flags &= ~MAIL_INDEX_FLAG_FSCK; if (msync(index->mmap_base, sizeof(MailIndexHeader), MS_SYNC) < 0) { diff -r 7cb03d43a0ea -r a4eb58705351 src/lib-index/mbox/mbox-rewrite.c --- a/src/lib-index/mbox/mbox-rewrite.c Tue Sep 17 08:17:10 2002 +0300 +++ b/src/lib-index/mbox/mbox-rewrite.c Tue Sep 17 08:19:22 2002 +0300 @@ -348,8 +348,10 @@ if (!failed) { if (rename(path, index->mbox_path) == 0) { - /* all ok, we need to fsck the index next time */ - index->header->flags |= MAIL_INDEX_FLAG_FSCK; + /* all ok, we need to fsck the index next time. + use set_flags because set_lock() would remove it + if we modified it directly */ + index->set_flags |= MAIL_INDEX_FLAG_FSCK; reset_dirty_flags(index); } else { index_set_error(index, "rename(%s, %s) failed: %m", diff -r 7cb03d43a0ea -r a4eb58705351 src/lib-storage/index/index-expunge.c --- a/src/lib-storage/index/index-expunge.c Tue Sep 17 08:17:10 2002 +0300 +++ b/src/lib-storage/index/index-expunge.c Tue Sep 17 08:19:22 2002 +0300 @@ -32,7 +32,7 @@ hdr->first_deleted_uid_lowwater); /* fsck should be enough to fix it */ - ibox->index->header->flags |= MAIL_INDEX_FLAG_FSCK; + ibox->index->set_flags |= MAIL_INDEX_FLAG_FSCK; return FALSE; } else { *seq = ibox->index->get_sequence(ibox->index, *rec);