dovecot-2.1: sdbox: Don't assert-crash on index rebuild if u.X f...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 12 05:18:06 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/5f96fb9f079b
changeset: 14121:5f96fb9f079b
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 12 05:16:43 2012 +0200
description:
sdbox: Don't assert-crash on index rebuild if u.X file exists in both primary and alt storage.
diffstat:
src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (38 lines):
diff -r f889e25711a1 -r 5f96fb9f079b src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c
--- a/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c Sun Feb 12 04:58:17 2012 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c Sun Feb 12 05:16:43 2012 +0200
@@ -25,8 +25,9 @@
&uid_validity, sizeof(uid_validity), TRUE);
}
-static int sdbox_sync_add_file_index(struct dbox_sync_rebuild_context *ctx,
- struct dbox_file *file, uint32_t uid)
+static int
+sdbox_sync_add_file_index(struct dbox_sync_rebuild_context *ctx,
+ struct dbox_file *file, uint32_t uid, bool primary)
{
uint32_t seq;
bool deleted;
@@ -50,6 +51,13 @@
return 0;
}
+ if (!dbox_file_is_in_alt(file) && !primary) {
+ /* we were supposed to open the file in alt storage, but it
+ exists in primary storage as well. skip it to avoid adding
+ it twice. */
+ return 0;
+ }
+
mail_index_append(ctx->trans, uid, &seq);
T_BEGIN {
dbox_sync_rebuild_index_metadata(ctx, seq, uid);
@@ -80,7 +88,7 @@
file = sdbox_file_init(mbox, uid);
if (!primary)
file->cur_path = file->alt_path;
- ret = sdbox_sync_add_file_index(ctx, file, uid);
+ ret = sdbox_sync_add_file_index(ctx, file, uid, primary);
dbox_file_unref(&file);
return ret;
}
More information about the dovecot-cvs
mailing list