From: Aki Tuomi Date: Mon, 21 Dec 2020 09:51:36 +0000 (+0200) Subject: lib: istream-file,ostream-file - Ignore ECONNRESET X-Git-Tag: 2.3.14.rc1~166 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=09a41a815b8b545e2575e86001ada283196978b7;p=thirdparty%2Fdovecot%2Fcore.git lib: istream-file,ostream-file - Ignore ECONNRESET This happens e.g. on FreeBSD when closing a socket that has not been fully flushed to client. Since we can't do anything about that, we might as well just ignore it. --- diff --git a/src/lib/istream-file.c b/src/lib/istream-file.c index e89e9d46d7..f6e0c72c5d 100644 --- a/src/lib/istream-file.c +++ b/src/lib/istream-file.c @@ -19,7 +19,10 @@ void i_stream_file_close(struct iostream_private *stream, struct istream_private *_stream = (struct istream_private *)stream; if (fstream->autoclose_fd && _stream->fd != -1) { - if (close(_stream->fd) < 0) { + /* Ignore ECONNRESET because we don't really care about it here, + as we are closing the socket down in any case. There might be + unsent data but nothing we can do about that. */ + if (close(_stream->fd) < 0 && errno != ECONNRESET) { i_error("file_istream.close(%s) failed: %m", i_stream_get_name(&_stream->istream)); } diff --git a/src/lib/ostream-file.c b/src/lib/ostream-file.c index f49c657ea0..fe4e592d75 100644 --- a/src/lib/ostream-file.c +++ b/src/lib/ostream-file.c @@ -38,7 +38,10 @@ static void stream_closed(struct file_ostream *fstream) io_remove(&fstream->io); if (fstream->autoclose_fd && fstream->fd != -1) { - if (close(fstream->fd) < 0) { + /* Ignore ECONNRESET because we don't really care about it here, + as we are closing the socket down in any case. There might be + unsent data but nothing we can do about that. */ + if (close(fstream->fd) < 0 && errno != ECONNRESET) { i_error("file_ostream.close(%s) failed: %m", o_stream_get_name(&fstream->ostream.ostream)); }