glocalfileoutputstream: Do not double-close an fd on unlink error

In case we fail unlinking a file we could close again an FD that has
been already just closed. So avoid this by unsetting it when closing.

Coverity CID: #1474462
This commit is contained in:
Marco Trevisan (Treviño) 2022-09-16 15:11:47 +02:00
parent d37beda25e
commit 2401e1a090

View File

@ -1194,6 +1194,7 @@ handle_overwrite_open (const char *filename,
if (replace_destination_set) if (replace_destination_set)
{ {
g_close (fd, NULL); g_close (fd, NULL);
fd = -1;
if (g_unlink (filename) != 0) if (g_unlink (filename) != 0)
{ {