[dovecot-cvs] dovecot/src/lib ostream-file.c, 1.61.2.1, 1.61.2.2 ostream.c, 1.16, 1.16.2.1

tss at dovecot.org tss at dovecot.org
Sat Nov 18 23:31:20 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv9735

Modified Files:
      Tag: branch_1_0
	ostream-file.c ostream.c 
Log Message:
If connection is closed while buffer is being flushed in uncorking, don't
assert-crash.



Index: ostream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ostream-file.c,v
retrieving revision 1.61.2.1
retrieving revision 1.61.2.2
diff -u -d -r1.61.2.1 -r1.61.2.2
--- ostream-file.c	7 Nov 2006 13:58:52 -0000	1.61.2.1
+++ ostream-file.c	18 Nov 2006 23:31:14 -0000	1.61.2.2
@@ -216,9 +216,11 @@
 		if (set && fstream->io != NULL)
 			io_remove(&fstream->io);
 		else if (!set) {
+			/* buffer flushing might close the stream */
 			ret = buffer_flush(fstream);
 			if (fstream->io == NULL &&
-			    (ret == 0 || fstream->flush_pending)) {
+			    (ret == 0 || fstream->flush_pending) &&
+			    !stream->ostream.closed) {
 				fstream->io = io_add(fstream->fd, IO_WRITE,
 						     stream_send_io, fstream);
 			}

Index: ostream.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ostream.c,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -d -r1.16 -r1.16.2.1
--- ostream.c	26 Feb 2006 10:05:06 -0000	1.16
+++ ostream.c	18 Nov 2006 23:31:14 -0000	1.16.2.1
@@ -77,7 +77,8 @@
 {
 	struct _ostream *_stream = stream->real_stream;
 
-	_stream->flush_pending(_stream, set);
+	if (!stream->closed)
+		_stream->flush_pending(_stream, set);
 }
 
 size_t o_stream_get_buffer_used_size(struct ostream *stream)



More information about the dovecot-cvs mailing list