dovecot-2.0: istream-attachment: Removed parent stream's size sa...

dovecot at dovecot.org dovecot at dovecot.org
Thu Nov 4 16:07:36 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/29c71b6e354e
changeset: 12381:29c71b6e354e
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Nov 04 14:07:30 2010 +0000
description:
istream-attachment: Removed parent stream's size sanity check. It didn't work right with base64 streams.

diffstat:

 src/lib-storage/index/istream-attachment.c |  13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diffs (33 lines):

diff -r fd44ba1fa729 -r 29c71b6e354e src/lib-storage/index/istream-attachment.c
--- a/src/lib-storage/index/istream-attachment.c	Wed Nov 03 18:00:15 2010 +0000
+++ b/src/lib-storage/index/istream-attachment.c	Thu Nov 04 14:07:30 2010 +0000
@@ -81,24 +81,21 @@
 }
 
 static const struct stat *
-i_stream_attachment_stat(struct istream_private *stream, bool exact)
+i_stream_attachment_stat(struct istream_private *stream, bool exact ATTR_UNUSED)
 {
 	struct attachment_istream *astream =
 		(struct attachment_istream *)stream;
 	const struct stat *st;
 
-	st = i_stream_stat(stream->parent, exact);
+	/* parent stream may be base64-decoder. don't waste time decoding the
+	   entire stream, since we already know what the size is supposed
+	   to be. */
+	st = i_stream_stat(stream->parent, FALSE);
 	if (st == NULL)
 		return NULL;
 
 	stream->statbuf = *st;
 	stream->statbuf.st_size = astream->size;
-	if (st->st_size != 0 && (uoff_t)st->st_size != astream->size) {
-		i_error("Attachment file %s size mismatch: "
-			"%"PRIuUOFF_T" != %"PRIuUOFF_T,
-			i_stream_get_name(stream->parent),
-			st->st_size, astream->size);
-	}
 	return &stream->statbuf;
 }
 


More information about the dovecot-cvs mailing list