dovecot-2.2: i_stream_default_stat(): If we can't know the size,...

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 28 01:43:34 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/fee60a91d586
changeset: 15420:fee60a91d586
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 28 01:43:24 2012 +0200
description:
i_stream_default_stat(): If we can't know the size, return -1 instead of assert crash.
This fixes a crash saving to mdbox when input stream's size wasn't known.

diffstat:

 src/lib/istream.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (21 lines):

diff -r 2b18b4b92cd9 -r fee60a91d586 src/lib/istream.c
--- a/src/lib/istream.c	Tue Nov 27 10:00:42 2012 +0200
+++ b/src/lib/istream.c	Wed Nov 28 01:43:24 2012 +0200
@@ -623,13 +623,13 @@
 	if (stream->parent == NULL)
 		return 0;
 
-	if (exact && !stream->stream_size_passthrough) {
-		i_panic("istream %s: stat() doesn't support getting exact size",
-			i_stream_get_name(&stream->istream));
-	}
 	if (i_stream_stat(stream->parent, exact, &st) < 0)
 		return -1;
 	stream->statbuf = *st;
+	if (exact && !stream->stream_size_passthrough) {
+		/* exact size is not known, even if parent returned something */
+		stream->statbuf.st_size = -1;
+	}
 	return 0;
 }
 


More information about the dovecot-cvs mailing list