$OpenBSD: patch-src_lib-storage_index_maildir_maildir-mail_c,v 1.1 2009/02/14 10:27:58 sthen Exp $
--- src/lib-storage/index/maildir/maildir-mail.c.orig	Tue Jan  6 09:33:51 2009
+++ src/lib-storage/index/maildir/maildir-mail.c	Fri Feb 13 17:48:55 2009
@@ -485,8 +485,16 @@ static void maildir_mail_set_cache_corrupted(struct ma
 					       _mail->uid, &flags);
 		if (maildir_filename_get_size(fname, MAILDIR_EXTRA_VIRTUAL_SIZE,
 					      &size)) {
-			i_error("Maildir filename has wrong W value: %s/%s",
-				mbox->path, fname);
+			const char *subdir =
+				(flags & MAILDIR_UIDLIST_REC_FLAG_NEW_DIR) != 0 ?
+				"new" : "cur";
+			mail_storage_set_critical(_mail->box->storage,
+				"Maildir filename has wrong W= value, "
+				"can't fix it automatically: %s/%s/%s",
+				mbox->path, subdir, fname);
+			/* don't bother setting cache corrupted since it
+			   doesn't fix anything. */
+			return;
 		} else if (maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid,
 				MAILDIR_UIDLIST_REC_EXT_VSIZE) != NULL) {
 			maildir_uidlist_set_ext(mbox->uidlist, _mail->uid,
