From: Timo Sirainen Date: Tue, 10 May 2011 15:19:35 +0000 (+0300) Subject: istream-[b]zlib: stat(exact=FALSE) should always return the same value if file hasn... X-Git-Tag: 2.0.13~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e34eee50039d1bd83fc8213f9b6c52ee50f3ecf2;p=thirdparty%2Fdovecot%2Fcore.git istream-[b]zlib: stat(exact=FALSE) should always return the same value if file hasn't changed. --- diff --git a/src/plugins/zlib/istream-bzlib.c b/src/plugins/zlib/istream-bzlib.c index fe4ba0ec4e..c94916f43e 100644 --- a/src/plugins/zlib/istream-bzlib.c +++ b/src/plugins/zlib/istream-bzlib.c @@ -273,7 +273,11 @@ i_stream_bzlib_stat(struct istream_private *stream, bool exact) if (st == NULL) return NULL; - if (zstream->eof_offset == (uoff_t)-1 && !exact) + /* when exact=FALSE always return the parent stat's size, even if we + know the exact value. this is necessary because otherwise e.g. mbox + code can see two different values and think that a compressed mbox + file keeps changing. */ + if (!exact) return st; stream->statbuf = *st; diff --git a/src/plugins/zlib/istream-zlib.c b/src/plugins/zlib/istream-zlib.c index f00aa412bb..bf1cf0c5f0 100644 --- a/src/plugins/zlib/istream-zlib.c +++ b/src/plugins/zlib/istream-zlib.c @@ -419,7 +419,11 @@ i_stream_zlib_stat(struct istream_private *stream, bool exact) if (st == NULL) return NULL; - if (zstream->eof_offset == (uoff_t)-1 && !exact) + /* when exact=FALSE always return the parent stat's size, even if we + know the exact value. this is necessary because otherwise e.g. mbox + code can see two different values and think that a compressed mbox + file keeps changing. */ + if (!exact) return st; stream->statbuf = *st;