Skip to content

Commit

Permalink
doveadm backup: Fixed unnecessary mailbox deletion.
Browse files Browse the repository at this point in the history
Broken by 79490ec. The idea is to delete the mailbox early to avoid
unnecessary work, but we deleted it too early. If the last mail(s) were
deleted instead of just expunging them we deleted the whole mailbox.
  • Loading branch information
sirainen committed May 20, 2016
1 parent d803151 commit 497920d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/doveadm/dsync/dsync-mailbox-import.c
Expand Up @@ -785,9 +785,10 @@ static bool dsync_mailbox_try_save_cur(struct dsync_mailbox_importer *importer,
/* add a record for local mail */
i_assert(importer->cur_mail != NULL);
if (importer->revert_local_changes) {
if (save_change == NULL) {
if (save_change == NULL &&
importer->cur_mail->uid >= importer->remote_uid_next) {
dsync_mailbox_revert_existing_uid(importer, importer->cur_mail->uid,
t_strdup_printf("highest than remote's UIDs (remote UIDNEXT=%u)", importer->remote_uid_next));
t_strdup_printf("higher than remote's UIDs (remote UIDNEXT=%u)", importer->remote_uid_next));
return TRUE;
}
mail_expunge(importer->cur_mail);
Expand Down

0 comments on commit 497920d

Please sign in to comment.