# HG changeset patch # User Timo Sirainen # Date 1173920717 -7200 # Node ID 5d1c8fd5a83ee3b3024210289d4b3cb2076cb441 # Parent 09b5de33144ec3fbbaeccb0b2c8fefef3ffc1fde 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. diff -r 09b5de33144e -r 5d1c8fd5a83e src/lib-index/mail-transaction-log.c --- a/src/lib-index/mail-transaction-log.c Wed Mar 14 21:39:25 2007 +0200 +++ b/src/lib-index/mail-transaction-log.c Thu Mar 15 03:05:17 2007 +0200 @@ -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