]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: istream-seekable - Don't double-close temp file fd on errors
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Sat, 14 Sep 2019 21:06:58 +0000 (00:06 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 8 Oct 2021 07:26:42 +0000 (07:26 +0000)
Closing the fd_input stream already auto-closes the fd.

src/lib/istream-seekable.c

index ef7f2c09a1e87e42b83f926eec290ee83ad7ee52..d1879fe81d86a1264ec11e60781fe1aa73aa971a 100644 (file)
@@ -125,7 +125,7 @@ static int copy_to_temp_file(struct seekable_istream *sstream)
                                i_stream_get_name(&stream->istream),
                                i_stream_get_error(sstream->fd_input));
                        i_stream_destroy(&sstream->fd_input);
-                       i_close_fd(&sstream->fd);
+                       sstream->fd = -1; /* autoclosed by fd_input */
                        return -1;
                }
        }
@@ -258,7 +258,7 @@ static int i_stream_seekable_write_failed(struct seekable_istream *sstream)
                return -1;
        }
        i_stream_destroy(&sstream->fd_input);
-       i_close_fd(&sstream->fd);
+       sstream->fd = -1; /* autoclosed by fd_input */
 
        i_free_and_null(sstream->temp_path);
        return 0;