Mercurial > dovecot > core-2.2
changeset 10132:47e1756f6047 HEAD
maildir: Expunging last messages from mailbox caused crashing.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 22 Oct 2009 17:56:01 -0400 |
parents | 9ef0821a2ce7 |
children | 1eedcee69ce7 |
files | src/lib-storage/index/maildir/maildir-sync-index.c |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-sync-index.c Thu Oct 22 12:58:35 2009 -0400 +++ b/src/lib-storage/index/maildir/maildir-sync-index.c Thu Oct 22 17:56:01 2009 -0400 @@ -29,7 +29,7 @@ enum mail_flags flags; ARRAY_TYPE(keyword_indexes) keywords, idx_keywords; - uint32_t seq, uid; + uint32_t /*seq, */uid; bool update_maildir_hdr_cur; }; @@ -45,10 +45,8 @@ enum maildir_uidlist_rec_flag flags; uint8_t guid_128[MAIL_GUID_128_SIZE]; const char *fname; - uint32_t uid; - mail_index_lookup_uid(ctx->view, seq, &uid); - if (maildir_uidlist_lookup(ctx->mbox->uidlist, uid, + if (maildir_uidlist_lookup(ctx->mbox->uidlist, ctx->uid, &flags, &fname) <= 0) memset(guid_128, 0, sizeof(guid_128)); else T_BEGIN { @@ -56,7 +54,7 @@ guid_128); } T_END; - mail_index_expunge_guid(ctx->trans, ctx->seq, guid_128); + mail_index_expunge_guid(ctx->trans, seq, guid_128); } static bool @@ -495,7 +493,7 @@ ctx->flags &= ~mbox->ibox.box.private_flags_mask; again: - ctx->seq = ++seq; + seq++; ctx->uid = uid; if (seq > hdr->messages_count) { @@ -605,8 +603,10 @@ if (!partial) { /* expunge the rest */ - for (seq++; seq <= hdr->messages_count; seq++) + for (seq++; seq <= hdr->messages_count; seq++) { + mail_index_lookup_uid(ctx->view, seq, &ctx->uid); maildir_index_expunge(ctx, seq); + } } /* add \Recent flags. use updated view so it contains newly