From: Timo Sirainen Date: Thu, 3 Apr 2014 09:50:43 +0000 (+0300) Subject: lib-ssl-iostream: Error handling fix. X-Git-Tag: 2.2.13.rc1~180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38661902500fe27575329346a4d5ee74db7602b3;p=thirdparty%2Fdovecot%2Fcore.git lib-ssl-iostream: Error handling fix. Don't set last_error="(null)" when the connection was simply disconnected. --- diff --git a/src/lib-ssl-iostream/istream-openssl.c b/src/lib-ssl-iostream/istream-openssl.c index 79e16af926..7a16253e39 100644 --- a/src/lib-ssl-iostream/istream-openssl.c +++ b/src/lib-ssl-iostream/istream-openssl.c @@ -71,14 +71,16 @@ static ssize_t i_stream_ssl_read_real(struct istream_private *stream) /* failed to read anything */ ret = openssl_iostream_handle_error(ssl_io, ret, "SSL_read"); if (ret <= 0) { - if (ret < 0) { + if (ret == 0) + return 0; + if (ssl_io->last_error != NULL) { io_stream_set_error(&stream->iostream, "%s", ssl_io->last_error); - stream->istream.stream_errno = errno; - stream->istream.eof = TRUE; - sstream->seen_eof = TRUE; } - return ret; + stream->istream.stream_errno = errno; + stream->istream.eof = TRUE; + sstream->seen_eof = TRUE; + return -1; } /* we did some BIO I/O, try reading again */ }