Mercurial > dovecot > core-2.2
changeset 11313:361157623f2a HEAD
lib-index: Give a better error message if transction log file shrinks unexpectedly.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 14 May 2010 16:18:03 +0200 |
parents | 4c7b240eccdf |
children | 664d1b2f6b46 |
files | src/lib-index/mail-transaction-log-file.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-file.c Fri May 14 14:16:38 2010 +0200 +++ b/src/lib-index/mail-transaction-log-file.c Fri May 14 16:18:03 2010 +0200 @@ -1146,6 +1146,12 @@ i_assert(file->sync_offset >= file->buffer_offset); data = buffer_get_data(file->buffer, &size); + if (file->buffer_offset + size < file->sync_offset) { + mail_transaction_log_file_set_corrupted(file, + "log file shrank (%"PRIuUOFF_T" < %"PRIuUOFF_T")", + file->buffer_offset + (uoff_t)size, file->sync_offset); + return -1; + } while (file->sync_offset - file->buffer_offset + sizeof(*hdr) <= size) { hdr = CONST_PTR_OFFSET(data, file->sync_offset - file->buffer_offset);