From: Aki Tuomi Date: Mon, 21 Dec 2020 09:50:51 +0000 (+0200) Subject: lib: fd-util - Ignore ECONNRESET when closing fd X-Git-Tag: 2.3.14.rc1~167 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=921bb0008acf2f5076ac2226230dd503c3d11e7e;p=thirdparty%2Fdovecot%2Fcore.git lib: fd-util - Ignore ECONNRESET when closing fd 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/fd-util.c b/src/lib/fd-util.c index 302beea709..01315bc417 100644 --- a/src/lib/fd-util.c +++ b/src/lib/fd-util.c @@ -151,7 +151,10 @@ void i_close_fd_path(int *fd, const char *path, const char *arg, } saved_errno = errno; - if (unlikely(close(*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 (unlikely(close(*fd) < 0 && errno != ECONNRESET)) i_error("%s: close(%s%s%s) @ %s:%d failed (fd=%d): %m", func, arg, (path == NULL) ? "" : " = ",