dovecot: When setting cache corrupted, make sure we don't write ...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Feb 16 15:44:26 EET 2008
details: http://hg.dovecot.org/dovecot/rev/e1cb4e647fa5
changeset: 7251:e1cb4e647fa5
user: Timo Sirainen <tss at iki.fi>
date: Sat Feb 16 15:43:42 2008 +0200
description:
When setting cache corrupted, make sure we don't write broken values to the
new cache file. Also log broken virtual size fetches better and support 0 as
a generic "some fields" value.
diffstat:
1 file changed, 17 insertions(+), 2 deletions(-)
src/lib-storage/index/index-mail.c | 19 +++++++++++++++++--
diffs (36 lines):
diff -r 7e8bcf1ef37b -r e1cb4e647fa5 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c Sat Feb 16 15:16:33 2008 +0200
+++ b/src/lib-storage/index/index-mail.c Sat Feb 16 15:43:42 2008 +0200
@@ -1336,6 +1336,15 @@ void index_mail_set_cache_corrupted(stru
const char *field_name;
switch (field) {
+ case 0:
+ field_name = "fields";
+ break;
+ case MAIL_FETCH_VIRTUAL_SIZE:
+ field_name = "virtual size";
+ imail->data.physical_size = (uoff_t)-1;
+ imail->data.virtual_size = (uoff_t)-1;
+ imail->data.parts = NULL;
+ break;
case MAIL_FETCH_MESSAGE_PARTS:
field_name = "MIME parts";
imail->data.parts = NULL;
@@ -1354,8 +1363,14 @@ void index_mail_set_cache_corrupted(stru
field_name = t_strdup_printf("#%x", field);
}
+ /* make sure we don't cache invalid values */
+ mail_cache_transaction_rollback(&imail->trans->cache_trans);
+ imail->trans->cache_trans =
+ mail_cache_get_transaction(imail->trans->cache_view,
+ imail->trans->trans);
+
+ imail->data.no_caching = TRUE;
mail_cache_set_corrupted(imail->ibox->cache,
"Broken %s for mail UID %u",
field_name, mail->uid);
-
-}
+}
More information about the dovecot-cvs
mailing list