# HG changeset patch # User Timo Sirainen # Date 1138308169 -7200 # Node ID 08a302d3e525f10f7432d19790c072a947cd51d1 # Parent 1357dd2c5b02a5d391d3734be03571215f9708d1 Boolean changes broke istream_raw_mbox_is_valid_from() when it hit unexpected EOF. So broken Content-Length headers at the end of files gave "file size unexpectedly shrinked in mbox" errors. diff -r 1357dd2c5b02 -r 08a302d3e525 src/lib-storage/index/mbox/istream-raw-mbox.c --- a/src/lib-storage/index/mbox/istream-raw-mbox.c Thu Jan 26 22:10:22 2006 +0200 +++ b/src/lib-storage/index/mbox/istream-raw-mbox.c Thu Jan 26 22:42:49 2006 +0200 @@ -340,7 +340,7 @@ input->real_stream->abs_start_offset); } -static bool istream_raw_mbox_is_valid_from(struct raw_mbox_istream *rstream) +static int istream_raw_mbox_is_valid_from(struct raw_mbox_istream *rstream) { const unsigned char *data; size_t size; @@ -354,7 +354,7 @@ if ((size == 1 && data[0] == '\n') || (size == 2 && data[0] == '\r' && data[1] == '\n')) { /* EOF */ - return TRUE; + return 1; } if (size > 31 && memcmp(data, "\nFrom ", 6) == 0) { @@ -364,7 +364,7 @@ data += 7; size -= 7; } else { - return FALSE; + return 0; } while (memchr(data, '\n', size) == NULL) { @@ -373,12 +373,12 @@ } if (mbox_from_parse(data, size, &received_time, &sender) < 0) - return FALSE; + return 0; rstream->next_received_time = received_time; i_free(rstream->next_sender); rstream->next_sender = sender; - return TRUE; + return 1; } uoff_t istream_raw_mbox_get_start_offset(struct istream *stream)