dovecot-2.2: iostream-rawlog: Avoid crashing if write() to rawlo...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 29 20:34:42 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/bab7bbc0c153
changeset: 15347:bab7bbc0c153
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 29 20:34:31 2012 +0200
description:
iostream-rawlog: Avoid crashing if write() to rawlog fails.

diffstat:

 src/lib/iostream-rawlog.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r bf834b3c5663 -r bab7bbc0c153 src/lib/iostream-rawlog.c
--- a/src/lib/iostream-rawlog.c	Mon Oct 29 20:17:07 2012 +0200
+++ b/src/lib/iostream-rawlog.c	Mon Oct 29 20:34:31 2012 +0200
@@ -96,7 +96,7 @@
 		return;
 	}
 
-	do {
+	while (rstream->rawlog_fd != -1 && size > 0) {
 		p = memchr(data, '\n', size);
 		if (p != NULL) {
 			line_ends = TRUE;
@@ -118,7 +118,7 @@
 
 		data += pos;
 		size -= pos;
-	} while (size > 0);
+	}
 }
 
 void iostream_rawlog_close(struct rawlog_iostream *rstream)


More information about the dovecot-cvs mailing list