[dovecot-cvs] dovecot/src/lib ostream-file.c, 1.62, 1.63 ostream.c, 1.16, 1.17

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


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

Modified Files:
	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.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- ostream-file.c	7 Nov 2006 13:58:56 -0000	1.62
+++ ostream-file.c	18 Nov 2006 23:31:16 -0000	1.63
@@ -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.17
diff -u -d -r1.16 -r1.17
--- ostream.c	26 Feb 2006 10:05:06 -0000	1.16
+++ ostream.c	18 Nov 2006 23:31:16 -0000	1.17
@@ -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