dovecot-2.2: lib: Added assert to i_stream_create_seekable*() to...

dovecot at dovecot.org dovecot at dovecot.org
Mon Mar 2 12:41:49 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/98302e52074e
changeset: 18281:98302e52074e
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 02 14:41:11 2015 +0200
description:
lib: Added assert to i_stream_create_seekable*() to have non-zero max_buffer_size.
This size is used for the created fd istream and it can't be zero.

diffstat:

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

diffs (30 lines):

diff -r 7b2275ae8c19 -r 98302e52074e src/lib/istream-seekable.c
--- a/src/lib/istream-seekable.c	Mon Mar 02 14:36:15 2015 +0200
+++ b/src/lib/istream-seekable.c	Mon Mar 02 14:41:11 2015 +0200
@@ -377,6 +377,8 @@
 	size_t size;
 	bool blocking = TRUE;
 
+	i_assert(max_buffer_size > 0);
+
 	/* if any of the streams isn't blocking, set ourself also nonblocking */
 	for (count = 0; input[count] != NULL; count++) {
 		if (!input[count]->blocking)
@@ -434,6 +436,8 @@
 			 int (*fd_callback)(const char **path_r, void *context),
 			 void *context)
 {
+	i_assert(max_buffer_size > 0);
+
 	/* If all input streams are seekable, use concat istream instead */
 	if (inputs_are_seekable(input))
 		return i_stream_create_concat(input);
@@ -475,6 +479,8 @@
 	struct seekable_istream *sstream;
 	struct istream *stream;
 
+	i_assert(max_buffer_size > 0);
+
 	if (inputs_are_seekable(input))
 		return i_stream_create_concat(input);
 


More information about the dovecot-cvs mailing list