dovecot-2.1: istream-concat: If looking up stream's size fails, ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jan 24 03:52:41 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/5c1471ae3005
changeset: 13983:5c1471ae3005
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jan 24 03:49:03 2012 +0200
description:
istream-concat: If looking up stream's size fails, log an error and handle it as error, not EOF.

diffstat:

 src/lib/istream-concat.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r 83a2e1ba3ab6 -r 5c1471ae3005 src/lib/istream-concat.c
--- a/src/lib/istream-concat.c	Sun Jan 22 21:38:48 2012 +0200
+++ b/src/lib/istream-concat.c	Tue Jan 24 03:49:03 2012 +0200
@@ -92,7 +92,7 @@
 	bool last_stream;
 
 	if (cstream->cur_input == NULL) {
-		stream->istream.eof = TRUE;
+		stream->istream.stream_errno = EINVAL;
 		return -1;
 	}
 
@@ -188,6 +188,9 @@
 			/* we'll need to figure out this stream's size */
 			st = i_stream_stat(cstream->input[i], TRUE);
 			if (st == NULL) {
+				i_error("istream-concat: "
+					"Failed to get size of stream %s",
+					i_stream_get_name(cstream->input[i]));
 				cstream->istream.istream.stream_errno =
 					cstream->input[i]->stream_errno;
 				return (unsigned int)-1;
@@ -217,7 +220,9 @@
 
 	cstream->cur_idx = find_v_offset(cstream, &v_offset);
 	if (cstream->cur_idx == (unsigned int)-1) {
+		/* failed */
 		cstream->cur_input = NULL;
+		stream->istream.stream_errno = EINVAL;
 		return;
 	}
 	cstream->cur_input = cstream->input[cstream->cur_idx];


More information about the dovecot-cvs mailing list