[dovecot-cvs] dovecot/src/lib-index mail-index-sync-ext.c, 1.16,
1.16.2.1 mail-index-sync-keywords.c, 1.9,
1.9.2.1 mail-index-sync-private.h, 1.29,
1.29.2.1 mail-index-sync-update.c, 1.96,
1.96.2.1 mail-index-sync.c, 1.72, 1.72.2.1
cras at dovecot.org
cras at dovecot.org
Thu May 18 13:08:59 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv2146
Modified Files:
Tag: branch_1_0
mail-index-sync-ext.c mail-index-sync-keywords.c
mail-index-sync-private.h mail-index-sync-update.c
mail-index-sync.c
Log Message:
If we're synchronizing a view (and not index itself) from transaction log,
give a different error message and don't mark the file corrupted.
Index: mail-index-sync-ext.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-ext.c,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -d -r1.16 -r1.16.2.1
--- mail-index-sync-ext.c 13 Jan 2006 20:26:13 -0000 1.16
+++ mail-index-sync-ext.c 18 May 2006 10:08:55 -0000 1.16.2.1
@@ -352,13 +352,13 @@
if (u->ext_id != (uint32_t)-1 &&
(!array_is_created(&map->extensions) ||
u->ext_id >= array_count(&map->extensions))) {
- mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Extension introduction for unknown id %u", u->ext_id);
return -1;
}
if (u->ext_id == (uint32_t)-1 && u->name_size == 0) {
- mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Extension introduction without id or name");
return -1;
}
@@ -454,7 +454,7 @@
uint32_t i;
if (ctx->cur_ext_id == (uint32_t)-1) {
- mail_transaction_log_view_set_corrupted(view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Extension reset without intro prefix");
return -1;
}
@@ -490,7 +490,7 @@
const struct mail_index_ext *ext;
if (ctx->cur_ext_id == (uint32_t)-1) {
- mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Extension header update without intro prefix");
return -1;
}
Index: mail-index-sync-keywords.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-keywords.c,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -d -r1.9 -r1.9.2.1
--- mail-index-sync-keywords.c 16 Feb 2006 15:23:03 -0000 1.9
+++ mail-index-sync-keywords.c 18 May 2006 10:08:55 -0000 1.9.2.1
@@ -260,7 +260,7 @@
seqset_offset += 4 - (seqset_offset % 4);
if (seqset_offset > hdr->size) {
- mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Keyword header ended unexpectedly");
return -1;
}
@@ -269,7 +269,7 @@
end = CONST_PTR_OFFSET(rec, hdr->size);
if (uid == end) {
- mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Keyword sequence list empty");
return -1;
}
@@ -306,9 +306,8 @@
while (uid+2 <= end) {
if (uid[0] > uid[1] || uid[0] == 0) {
- mail_transaction_log_view_set_corrupted(
- ctx->view->log_view,
- "Keyword record UIDs are broken");
+ mail_index_sync_set_corrupted(ctx,
+ "Keyword record UIDs are broken");
return -1;
}
Index: mail-index-sync-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-private.h,v
retrieving revision 1.29
retrieving revision 1.29.2.1
diff -u -d -r1.29 -r1.29.2.1
--- mail-index-sync-private.h 2 May 2006 22:06:32 -0000 1.29
+++ mail-index-sync-private.h 18 May 2006 10:08:55 -0000 1.29.2.1
@@ -96,4 +96,7 @@
const struct mail_transaction_header *hdr,
const struct mail_transaction_keyword_reset *r);
+void mail_index_sync_set_corrupted(struct mail_index_sync_map_ctx *ctx,
+ const char *fmt, ...) __attr_format__(2, 3);
+
#endif
Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.96
retrieving revision 1.96.2.1
diff -u -d -r1.96 -r1.96.2.1
--- mail-index-sync-update.c 3 May 2006 19:43:25 -0000 1.96
+++ mail-index-sync-update.c 18 May 2006 10:08:56 -0000 1.96.2.1
@@ -131,7 +131,7 @@
unsigned int i, expunge_handlers_count;
if (e->uid1 > e->uid2 || e->uid1 == 0) {
- mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Invalid UID range in expunge (%u .. %u)",
e->uid1, e->uid2);
return -1;
@@ -228,7 +228,7 @@
void *dest;
if (rec->uid < map->hdr.next_uid) {
- mail_transaction_log_view_set_corrupted(view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Append with UID %u, but next_uid = %u",
rec->uid, map->hdr.next_uid);
return -1;
@@ -277,7 +277,7 @@
uint32_t idx, seq1, seq2;
if (u->uid1 > u->uid2 || u->uid1 == 0) {
- mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Invalid UID range in flag update (%u .. %u)",
u->uid1, u->uid2);
return -1;
@@ -331,7 +331,7 @@
if (u->offset >= map->hdr.base_header_size ||
u->offset + u->size > map->hdr.base_header_size) {
- mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Header update outside range: %u + %u > %u",
u->offset, u->size, map->hdr.base_header_size);
return -1;
@@ -551,8 +551,7 @@
unsigned int record_size;
if (ctx->cur_ext_id == (uint32_t)-1) {
- mail_transaction_log_view_set_corrupted(
- ctx->view->log_view,
+ mail_index_sync_set_corrupted(ctx,
"Extension record update update "
"without intro prefix");
ret = -1;
Index: mail-index-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync.c,v
retrieving revision 1.72
retrieving revision 1.72.2.1
diff -u -d -r1.72 -r1.72.2.1
--- mail-index-sync.c 3 May 2006 22:01:22 -0000 1.72
+++ mail-index-sync.c 18 May 2006 10:08:56 -0000 1.72.2.1
@@ -735,3 +735,24 @@
return FALSE;
}
}
+
+void mail_index_sync_set_corrupted(struct mail_index_sync_map_ctx *ctx,
+ const char *fmt, ...)
+{
+ const char *error;
+ va_list va;
+
+ va_start(va, fmt);
+ t_push();
+ error = t_strdup_vprintf(fmt, va);
+ if (ctx->type == MAIL_INDEX_SYNC_HANDLER_INDEX) {
+ mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+ "%s", error);
+ } else {
+ mail_index_set_error(ctx->view->index,
+ "View synchronization from transaction log failed: %s",
+ error);
+ }
+ t_pop();
+ va_end(va);
+}
More information about the dovecot-cvs
mailing list