From: Timo Sirainen Date: Thu, 22 Jan 2009 00:42:35 +0000 (+0200) Subject: dbox rebuild: Dont try to give unknown maildir files UIDs that are after uidlist... X-Git-Tag: 1.2.beta1~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d12b9d7a0a14e288085caa3fb008c77cca6c5aae;p=thirdparty%2Fdovecot%2Fcore.git dbox rebuild: Dont try to give unknown maildir files UIDs that are after uidlist's nextuid. Although it might allow keeping the same UIDs after repeated rebuilds, if any of the files were deleted at some point the UIDs would change and that would be just worse. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/dbox/dbox-sync-rebuild.c b/src/lib-storage/index/dbox/dbox-sync-rebuild.c index d0193aff42..b196603a64 100644 --- a/src/lib-storage/index/dbox/dbox-sync-rebuild.c +++ b/src/lib-storage/index/dbox/dbox-sync-rebuild.c @@ -339,30 +339,15 @@ static int dbox_sync_index_rebuild_dir(struct dbox_sync_rebuild_context *ctx, static int dbox_sync_new_maildir(struct dbox_sync_rebuild_context *ctx) { struct mail_index_view *trans_view; - const struct mail_index_header *hdr; char *const *fnames; unsigned int i, count; - uint32_t next_uid, seq; int ret = 0; fnames = array_get(&ctx->maildir_new_files, &count); if (count == 0) return 0; - /* try to give them UIDs beginning from uidlist's next_uid */ - next_uid = maildir_uidlist_get_next_uid(ctx->maildir_uidlist); - trans_view = mail_index_transaction_open_updated_view(ctx->trans); - for (i = 0; i < count; i++) { - if (mail_index_lookup_seq(trans_view, next_uid, &seq)) - break; - } - - if (i == count) - ctx->maildir_new_uid = next_uid; - else { - hdr = mail_index_get_header(trans_view); - ctx->maildir_new_uid = hdr->next_uid; - } + ctx->maildir_new_uid = mail_index_get_header(trans_view)->next_uid; mail_index_view_close(&trans_view); for (i = 0; i < count && ret == 0; i++) {