changeset 239:1e05ff078961 HEAD

hash creation was buggy
author Timo Sirainen <tss@iki.fi>
date Mon, 16 Sep 2002 07:22:52 +0300
parents acb77be5d683
children 5523767c0515
files src/lib-index/mail-hash.c
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-hash.c	Mon Sep 16 07:16:16 2002 +0300
+++ b/src/lib-index/mail-hash.c	Mon Sep 16 07:22:52 2002 +0300
@@ -159,7 +159,6 @@
 		return FALSE;
 
 	return mmap_update_real(hash) && hash_verify_header(hash);
-
 }
 
 static void hash_munmap(MailHash *hash)
@@ -199,12 +198,23 @@
 	i_assert(index->lock_type == MAIL_LOCK_EXCLUSIVE);
 
 	hash = mail_hash_new(index);
-	if (!mail_hash_rebuild(hash) || !hash_verify_header(index->hash)) {
-		mail_hash_free(hash);
-		return FALSE;
-	}
+	do {
+		if (!mail_hash_rebuild(hash))
+			break;
+
+		if (!hash->anon_mmap) {
+			if (!mmap_update_real(hash))
+				break;
+		}
 
-	return TRUE;
+		if (!hash_verify_header(hash))
+			break;
+
+		return TRUE;
+	} while (0);
+
+	mail_hash_free(hash);
+	return FALSE;
 }
 
 int mail_hash_open_or_create(MailIndex *index)