]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: o_stream_unix_write_fd() - Don't close fd on write failure
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 16 Dec 2022 16:19:09 +0000 (18:19 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 27 Jan 2023 13:01:47 +0000 (13:01 +0000)
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.

src/lib/ostream-unix.c

index 06e918f3b28bff5f2602f17bda051844761e9be6..279913549a2dc128d1357e67c82b2e51177bcb20 100644 (file)
@@ -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);
 }