comparison src/lib/ostream.c @ 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 2e2563132d5f
children cb108f786fb4
comparison
equal deleted inserted replaced
21776:1481b5e5e717 21777:ad5fd5b950db
142 142
143 if (unlikely(stream->closed || stream->stream_errno != 0)) 143 if (unlikely(stream->closed || stream->stream_errno != 0))
144 return; 144 return;
145 145
146 _stream->cork(_stream, TRUE); 146 _stream->cork(_stream, TRUE);
147 if (stream->stream_errno != 0)
148 errno = stream->last_failed_errno = stream->stream_errno;
147 } 149 }
148 150
149 void o_stream_uncork(struct ostream *stream) 151 void o_stream_uncork(struct ostream *stream)
150 { 152 {
151 struct ostream_private *_stream = stream->real_stream; 153 struct ostream_private *_stream = stream->real_stream;