[dovecot-cvs] dovecot/src/lib-index mail-transaction-log.c, 1.111.2.15, 1.111.2.16

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


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

Modified Files:
      Tag: branch_1_0
	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.111.2.15
retrieving revision 1.111.2.16
diff -u -d -r1.111.2.15 -r1.111.2.16
--- mail-transaction-log.c	11 Mar 2007 17:43:07 -0000	1.111.2.15
+++ mail-transaction-log.c	15 Mar 2007 01:05:13 -0000	1.111.2.16
@@ -1110,7 +1110,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);
@@ -1137,7 +1137,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