changeset 271:bd51b6445bcd HEAD

..better crashfix, to fix mbox crashes too..
author Timo Sirainen <tss@iki.fi>
date Thu, 19 Sep 2002 20:14:34 +0300
parents 6dfdda80e822
children de8683b5bb16
files src/lib-index/mail-index-open.c
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-open.c	Thu Sep 19 20:04:00 2002 +0300
+++ b/src/lib-index/mail-index-open.c	Thu Sep 19 20:14:34 2002 +0300
@@ -154,13 +154,11 @@
 
 static int index_open_and_fix(MailIndex *index, int update_recent)
 {
-	MailIndexHeader *hdr;
 	int rebuild;
 
 	if (!mail_index_mmap_update(index))
 		return FALSE;
 
-	hdr = index->header;
 	rebuild = FALSE;
 
 	/* open/create the index files */
@@ -181,11 +179,10 @@
 	if (!mail_custom_flags_open_or_create(index))
 		return FALSE;
 
-	if (rebuild || (hdr->flags & MAIL_INDEX_FLAG_REBUILD)) {
+	if (rebuild || (index->header->flags & MAIL_INDEX_FLAG_REBUILD)) {
 		/* index is corrupted, rebuild */
 		if (!index->rebuild(index))
 			return FALSE;
-		hdr = index->header;
 
 		/* no inconsistency problems while still opening
 		   the index */
@@ -197,19 +194,19 @@
 	if (!mail_modifylog_open_or_create(index))
 		return FALSE;
 
-	if (hdr->flags & MAIL_INDEX_FLAG_FSCK) {
+	if (index->header->flags & MAIL_INDEX_FLAG_FSCK) {
 		/* index needs fscking */
 		if (!index->fsck(index))
 			return FALSE;
 	}
 
-	if (hdr->flags & MAIL_INDEX_FLAG_COMPRESS) {
+	if (index->header->flags & MAIL_INDEX_FLAG_COMPRESS) {
 		/* remove deleted blocks from index file */
 		if (!mail_index_compress(index))
 			return FALSE;
 	}
 
-	if (hdr->flags & MAIL_INDEX_FLAG_REBUILD_HASH) {
+	if (index->header->flags & MAIL_INDEX_FLAG_REBUILD_HASH) {
 		if (!mail_hash_rebuild(index->hash))
 			return FALSE;
 	}
@@ -219,13 +216,13 @@
 	if (!index->sync(index))
 		return FALSE;
 
-	if (hdr->flags & MAIL_INDEX_FLAG_CACHE_FIELDS) {
+	if (index->header->flags & MAIL_INDEX_FLAG_CACHE_FIELDS) {
 		/* need to update cached fields */
 		if (!mail_index_update_cache(index))
 			return FALSE;
 	}
 
-	if (hdr->flags & MAIL_INDEX_FLAG_COMPRESS_DATA) {
+	if (index->header->flags & MAIL_INDEX_FLAG_COMPRESS_DATA) {
 		/* remove unused space from index data file.
 		   keep after cache_fields which may move data
 		   and create unused space.. */