]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: istream-file,ostream-file - Mark close failure as unlikely
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 11 Jan 2021 09:04:57 +0000 (11:04 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 12 Jan 2021 07:01:22 +0000 (07:01 +0000)
File descriptor close failure is unlikely to happen.

src/lib/istream-file.c
src/lib/ostream-file.c

index f6e0c72c5df9040bd184bd0e0839ab17d926b007..464ca967599036b4c9511cef25bebb8cf2f5ea63 100644 (file)
@@ -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));
                }
index fe4e592d75aa761d68ebb1c5924e85c57829d1b0..f2abefd873ae4f546bb94ef4de1703f99255d1d0 100644 (file)
@@ -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));
                }