dovecot-2.0: istream-[b]zlib: stat(exact=FALSE) should always re...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 10 18:19:42 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/15a0687ec9d0
changeset: 12788:15a0687ec9d0
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 10 18:19:35 2011 +0300
description:
istream-[b]zlib: stat(exact=FALSE) should always return the same value if file hasn't changed.

diffstat:

 src/plugins/zlib/istream-bzlib.c |  6 +++++-
 src/plugins/zlib/istream-zlib.c  |  6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r b74dfa49692b -r 15a0687ec9d0 src/plugins/zlib/istream-bzlib.c
--- a/src/plugins/zlib/istream-bzlib.c	Tue May 10 17:55:27 2011 +0300
+++ b/src/plugins/zlib/istream-bzlib.c	Tue May 10 18:19:35 2011 +0300
@@ -273,7 +273,11 @@
 	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 -r b74dfa49692b -r 15a0687ec9d0 src/plugins/zlib/istream-zlib.c
--- a/src/plugins/zlib/istream-zlib.c	Tue May 10 17:55:27 2011 +0300
+++ b/src/plugins/zlib/istream-zlib.c	Tue May 10 18:19:35 2011 +0300
@@ -419,7 +419,11 @@
 	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;


More information about the dovecot-cvs mailing list