changeset 21777:ad5fd5b950db

lib: Add missing error handling to o_stream_cork() With ostream-file the corking could have called buffer_flush(), which could have failed and set stream_errno, but nothing would set last_failed_errno. Fixes: Panic: file ostream.c: line 59 (o_stream_close_full): assertion failed: (stream->last_failed_errno != 0)
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 22 Mar 2017 01:05:37 +0200
parents 1481b5e5e717
children 71298a01f82f
files src/lib/ostream.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ostream.c	Mon Mar 20 20:21:56 2017 +0200
+++ b/src/lib/ostream.c	Wed Mar 22 01:05:37 2017 +0200
@@ -144,6 +144,8 @@
 		return;
 
 	_stream->cork(_stream, TRUE);
+	if (stream->stream_errno != 0)
+		errno = stream->last_failed_errno = stream->stream_errno;
 }
 
 void o_stream_uncork(struct ostream *stream)