Mercurial > dovecot > core-2.2
changeset 13247:d2890dd972ae
lib-index: Avoid crashing when dealing with duplicate transaction log sequences.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 15 Aug 2011 14:48:18 +0300 |
parents | 282bd80ce7b2 |
children | e17f48dc9fc6 |
files | src/lib-index/mail-transaction-log-file.c |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-file.c Mon Aug 15 14:33:36 2011 +0300 +++ b/src/lib-index/mail-transaction-log-file.c Mon Aug 15 14:48:18 2011 +0300 @@ -527,10 +527,9 @@ opened. it shouldn't happen unless the old log file was corrupted. */ for (f = file->log->files; f != NULL; f = f->next) { - if (f->hdr.file_seq == file->hdr.file_seq && !f->corrupted) { + if (f->hdr.file_seq == file->hdr.file_seq) { /* mark the old file corrupted. we can't safely remove it from the list however, so return failure. */ - f->corrupted = TRUE; f->hdr.indexid = 0; if (strcmp(f->filepath, f->log->head->filepath) != 0) { /* only mark .2 corrupted, just to make sure @@ -541,10 +540,13 @@ } else { ret = -1; } - mail_index_set_error(f->log->index, - "Transaction log %s: " - "duplicate transaction log sequence (%u)", - f->filepath, f->hdr.file_seq); + if (!f->corrupted) { + f->corrupted = TRUE; + mail_index_set_error(f->log->index, + "Transaction log %s: " + "duplicate transaction log sequence (%u)", + f->filepath, f->hdr.file_seq); + } return ret; } }