From: Timo Sirainen Date: Fri, 16 Dec 2022 16:19:09 +0000 (+0200) Subject: lib: o_stream_unix_write_fd() - Don't close fd on write failure X-Git-Tag: 2.4.0~3103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1552ad0efd396c386a762612f19d4f51f32e6270;p=thirdparty%2Fdovecot%2Fcore.git lib: o_stream_unix_write_fd() - Don't close fd on write failure On success the write_fd is set to -1 without closing it, so the caller is responsible for closing it. If o_stream_unix_close() is reached with write_fd != -1, it means the write failed. The write_fd shouldn't be closed in that case either. This function wasn't actually currently used anywhere. --- diff --git a/src/lib/ostream-unix.c b/src/lib/ostream-unix.c index 06e918f3b2..279913549a 100644 --- a/src/lib/ostream-unix.c +++ b/src/lib/ostream-unix.c @@ -13,11 +13,6 @@ struct unix_ostream { static void o_stream_unix_close(struct iostream_private *stream, bool close_parent) { - struct unix_ostream *ustream = - container_of(stream, struct unix_ostream, - fstream.ostream.iostream); - - i_close_fd(&ustream->write_fd); o_stream_file_close(stream, close_parent); }