dovecot: If keyword ext record is missing, log an error instead ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 27 18:28:56 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/58b6fb965e62
changeset: 6320:58b6fb965e62
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 27 17:55:05 2007 +0300
description:
If keyword ext record is missing, log an error instead of assert-crashing.

diffstat:

1 file changed, 7 insertions(+), 9 deletions(-)
src/lib-index/mail-index-sync-keywords.c |   16 +++++++---------

diffs (27 lines):

diff -r c2c8ee636157 -r 58b6fb965e62 src/lib-index/mail-index-sync-keywords.c
--- a/src/lib-index/mail-index-sync-keywords.c	Mon Aug 27 17:47:25 2007 +0300
+++ b/src/lib-index/mail-index-sync-keywords.c	Mon Aug 27 17:55:05 2007 +0300
@@ -273,16 +273,14 @@ int mail_index_sync_keywords(struct mail
 	}
 
 	ext_id = mail_index_map_lookup_ext(ctx->view->map, "keywords");
-	if (ext_id == (uint32_t)-1) {
+	ext = ext_id == (uint32_t)-1 ? NULL :
+		array_idx(&ctx->view->map->extensions, ext_id);
+	if (ext == NULL || ext->record_size == 0) {
 		/* nothing to do */
-		i_assert(rec->modify_type == MODIFY_REMOVE);
-		return 1;
-	}
-
-	ext = array_idx(&ctx->view->map->extensions, ext_id);
-	if (ext->record_size == 0) {
-		/* nothing to do */
-		i_assert(rec->modify_type == MODIFY_REMOVE);
+		if (rec->modify_type != MODIFY_REMOVE) {
+			mail_index_sync_set_corrupted(ctx,
+				"Keyword ext record missing for added keyword");
+		}
 		return 1;
 	}
 


More information about the dovecot-cvs mailing list