From: Timo Sirainen Date: Thu, 22 Sep 2016 10:47:42 +0000 (+0300) Subject: pop3-migration: "first POP3 msg" warning didn't actually show the first one. X-Git-Tag: 2.2.26~234 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3963433feb6d47b42fde78d166af04e58e21644;p=thirdparty%2Fdovecot%2Fcore.git pop3-migration: "first POP3 msg" warning didn't actually show the first one. It was showing the first index in an array, which had nothing to do with being the first POP3 message number. --- diff --git a/src/plugins/pop3-migration/pop3-migration-plugin.c b/src/plugins/pop3-migration/pop3-migration-plugin.c index 943a5b9d3c..05138bf318 100644 --- a/src/plugins/pop3-migration/pop3-migration-plugin.c +++ b/src/plugins/pop3-migration/pop3-migration-plugin.c @@ -608,7 +608,7 @@ pop3_uidl_assign_by_hdr_hash(struct mailbox *box, struct mailbox *pop3_box) struct imap_msg_map *imap_map; unsigned int pop3_idx, imap_idx, pop3_count, imap_count; unsigned int first_seq, missing_uids_count; - uint32_t first_missing_idx = (uint32_t)-1; + uint32_t first_missing_idx = 0, first_missing_seq = (uint32_t)-1; int ret; first_seq = mbox->first_unfound_idx+1; @@ -656,8 +656,11 @@ pop3_uidl_assign_by_hdr_hash(struct mailbox *box, struct mailbox *pop3_box) } else if (!pop3_map[pop3_idx].common.hdr_sha1_set) { /* we treated this mail as expunged - ignore */ } else { - if (first_missing_idx == (uint32_t)-1) + uint32_t seq = pop3_map[pop3_idx].pop3_seq; + if (first_missing_seq > seq) { + first_missing_seq = seq; first_missing_idx = pop3_idx; + } missing_uids_count++; } } @@ -666,8 +669,7 @@ pop3_uidl_assign_by_hdr_hash(struct mailbox *box, struct mailbox *pop3_box) str_printfa(str, "pop3_migration: %u POP3 messages have no " "matching IMAP messages (first POP3 msg %u UIDL %s)", - missing_uids_count, - pop3_map[first_missing_idx].pop3_seq, + missing_uids_count, first_missing_seq, pop3_map[first_missing_idx].pop3_uidl); if (imap_count + missing_uids_count == pop3_count) { str_append(str, " - all IMAP messages were found "