changeset 2926:c035583b4839 HEAD

Make sure index is reopened if it's marked corrupted.
author Timo Sirainen <tss@iki.fi>
date Fri, 03 Dec 2004 06:58:37 +0200
parents f7e3283137db
children 6e2129a4a595
files src/lib-index/mail-index.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index.c	Fri Dec 03 06:57:59 2004 +0200
+++ b/src/lib-index/mail-index.c	Fri Dec 03 06:58:37 2004 +0200
@@ -1112,8 +1112,15 @@
 {
 	int i = 0, ret;
 
-	if (index->opened)
-		return 0;
+	if (index->opened) {
+		if (index->hdr != NULL &&
+		    (index->hdr->flags & MAIL_INDEX_HDR_FLAG_CORRUPTED) != 0) {
+			/* corrupted, reopen files */
+                        mail_index_close(index);
+		} else {
+			return 0;
+		}
+	}
 
 	index->filepath = i_strconcat(index->dir, "/", index->prefix, NULL);