dovecot-2.2: lib: Make sure ostream.last_failed_errno is always ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 27 21:42:33 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/39e2455a5e2d
changeset: 18034:39e2455a5e2d
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 27 23:29:39 2014 +0200
description:
lib: Make sure ostream.last_failed_errno is always set when stream_errno is set.

diffstat:

 src/lib/ostream.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (33 lines):

diff -r 3402a3d19f40 -r 39e2455a5e2d src/lib/ostream.c
--- a/src/lib/ostream.c	Mon Oct 27 23:26:10 2014 +0200
+++ b/src/lib/ostream.c	Mon Oct 27 23:29:39 2014 +0200
@@ -55,8 +55,12 @@
 		stream->closed = TRUE;
 	}
 
-	if (stream->stream_errno == 0)
+	if (stream->stream_errno != 0)
+		i_assert(stream->last_failed_errno != 0);
+	else {
 		stream->stream_errno = EPIPE;
+		stream->last_failed_errno = EPIPE;
+	}
 }
 
 void o_stream_destroy(struct ostream **stream)
@@ -516,6 +520,7 @@
 		      uoff_t offset ATTR_UNUSED)
 {
 	_stream->ostream.stream_errno = ESPIPE;
+	_stream->ostream.last_failed_errno = ESPIPE;
 	return -1;
 }
 
@@ -525,6 +530,7 @@
 			  size_t size ATTR_UNUSED, uoff_t offset ATTR_UNUSED)
 {
 	_stream->ostream.stream_errno = ESPIPE;
+	_stream->ostream.last_failed_errno = ESPIPE;
 	return -1;
 }
 


More information about the dovecot-cvs mailing list