[dovecot-cvs] dovecot/src/lib-index mail-transaction-log.c, 1.127, 1.128

tss at dovecot.org tss at dovecot.org
Thu Mar 15 03:05:19 EET 2007


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv29406

Modified Files:
	mail-transaction-log.c 
Log Message:
Don't give "Unexpected garbage at EOF" error if we don't see a full
transaction header's worth of data. It could be just that another process is
in the middle of writing the first header.



Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- mail-transaction-log.c	11 Mar 2007 17:43:10 -0000	1.127
+++ mail-transaction-log.c	15 Mar 2007 01:05:17 -0000	1.128
@@ -1104,7 +1104,7 @@
 {
         const struct mail_transaction_header *hdr;
 	const void *data;
-	size_t size;
+	size_t size, avail;
 	uint32_t hdr_size = 0;
 
 	data = buffer_get_data(file->buffer, &size);
@@ -1131,7 +1131,8 @@
 		file->sync_offset += hdr_size;
 	}
 
-	if (file->sync_offset - file->buffer_offset != size) {
+	avail = file->sync_offset - file->buffer_offset;
+	if (avail != size && avail >= sizeof(*hdr)) {
 		/* record goes outside the file we've seen. or if
 		   we're accessing the log file via unlocked mmaped
 		   memory, it may be just that the memory was updated



More information about the dovecot-cvs mailing list