dovecot-2.0: lib-index: Give a better error message if transctio...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 14 17:21:02 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/361157623f2a
changeset: 11313:361157623f2a
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 14 16:18:03 2010 +0200
description:
lib-index: Give a better error message if transction log file shrinks unexpectedly.

diffstat:

 src/lib-index/mail-transaction-log-file.c |  6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (16 lines):

diff -r 4c7b240eccdf -r 361157623f2a src/lib-index/mail-transaction-log-file.c
--- 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);


More information about the dovecot-cvs mailing list