changeset 2920:9b772db4503d HEAD

Don't write to closed cache file
author Timo Sirainen <tss@iki.fi>
date Mon, 29 Nov 2004 19:38:38 +0200
parents 3cc0a992ac7d
children a5eda271256f
files src/lib-index/mail-cache.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-cache.c	Mon Nov 29 19:35:45 2004 +0200
+++ b/src/lib-index/mail-cache.c	Mon Nov 29 19:38:38 2004 +0200
@@ -392,6 +392,12 @@
 
 	cache->locked = FALSE;
 
+	if (MAIL_CACHE_IS_UNUSABLE(cache)) {
+		/* we found it to be broken during the lock. just clean up. */
+		cache->hdr_modified = FALSE;
+		return;
+	}
+
 	if (cache->hdr_modified) {
 		cache->hdr_modified = FALSE;
 		if (pwrite_full(cache->fd, &cache->hdr_copy,