]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
istream-[b]zlib: stat(exact=FALSE) should always return the same value if file hasn...
authorTimo Sirainen <tss@iki.fi>
Tue, 10 May 2011 15:19:35 +0000 (18:19 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 10 May 2011 15:19:35 +0000 (18:19 +0300)
src/plugins/zlib/istream-bzlib.c
src/plugins/zlib/istream-zlib.c

index fe4ba0ec4e1656a752ecb6a568a14891056e7244..c94916f43e8ac2fa575caa687deec3ee7e57acaa 100644 (file)
@@ -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;
index f00aa412bbf6dd6eabc3072dae3ec91eeb916eac..bf1cf0c5f0f3697262674cb5c607bc933e41238d 100644 (file)
@@ -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;