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.
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));
}
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));
}