From: Aki Tuomi Date: Mon, 11 Jan 2021 09:04:57 +0000 (+0200) Subject: lib: istream-file,ostream-file - Mark close failure as unlikely X-Git-Tag: 2.3.14.rc1~165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=daa7f7d285e3df85079dc505bb3763e0f67f4afd;p=thirdparty%2Fdovecot%2Fcore.git lib: istream-file,ostream-file - Mark close failure as unlikely File descriptor close failure is unlikely to happen. --- diff --git a/src/lib/istream-file.c b/src/lib/istream-file.c index f6e0c72c5d..464ca96759 100644 --- a/src/lib/istream-file.c +++ b/src/lib/istream-file.c @@ -22,7 +22,7 @@ void i_stream_file_close(struct iostream_private *stream, /* 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) { + if (unlikely(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 fe4e592d75..f2abefd873 100644 --- a/src/lib/ostream-file.c +++ b/src/lib/ostream-file.c @@ -41,7 +41,7 @@ static void stream_closed(struct file_ostream *fstream) /* 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) { + if (unlikely(close(fstream->fd) < 0 && errno != ECONNRESET)) { i_error("file_ostream.close(%s) failed: %m", o_stream_get_name(&fstream->ostream.ostream)); }