dovecot-2.2: ostream-file: Fixed writing with zero buffer size.

dovecot at dovecot.org dovecot at dovecot.org
Sat Aug 18 15:56:38 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/23e9660f0473
changeset: 14915:23e9660f0473
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Aug 18 15:56:30 2012 +0300
description:
ostream-file: Fixed writing with zero buffer size.

diffstat:

 src/lib/ostream-file.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r 373879abd7f4 -r 23e9660f0473 src/lib/ostream-file.c
--- a/src/lib/ostream-file.c	Sat Aug 18 10:31:19 2012 +0300
+++ b/src/lib/ostream-file.c	Sat Aug 18 15:56:30 2012 +0300
@@ -174,6 +174,8 @@
 
 	o_stream_socket_cork(fstream);
 	if (iov_size == 1) {
+		i_assert(iov->iov_len > 0);
+
 		if (!fstream->file ||
 		    fstream->real_offset == fstream->buffer_offset) {
 			ret = write(fstream->fd, iov->iov_base, iov->iov_len);
@@ -505,7 +507,8 @@
 		if (fstream->tail == fstream->buffer_size)
 			fstream->tail = 0;
 
-		if (fstream->head == fstream->tail)
+		if (fstream->head == fstream->tail &&
+		    fstream->buffer_size > 0)
 			fstream->full = TRUE;
 	}
 


More information about the dovecot-cvs mailing list