1From 2401e1a090dcaac7614a8984cd3e3832a2a476ab Mon Sep 17 00:00:00 2001 2From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net> 3Date: Fri, 16 Sep 2022 15:11:47 +0200 4Subject: [PATCH] glocalfileoutputstream: Do not double-close an fd on unlink 5 error 6 7In case we fail unlinking a file we could close again an FD that has 8been already just closed. So avoid this by unsetting it when closing. 9 10Coverity CID: #1474462 11 12Conflict:NA 13Reference:https://gitlab.gnome.org/GNOME/glib/-/commit/2401e1a090dcaac7614a8984cd3e3832a2a476ab 14 15--- 16 gio/glocalfileoutputstream.c | 1 + 17 1 file changed, 1 insertion(+) 18 19diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c 20index 78d3e85..a61d5b5 100644 21--- a/gio/glocalfileoutputstream.c 22+++ b/gio/glocalfileoutputstream.c 23@@ -1163,6 +1163,7 @@ handle_overwrite_open (const char *filename, 24 if (replace_destination_set) 25 { 26 g_close (fd, NULL); 27+ fd = -1; 28 29 if (g_unlink (filename) != 0) 30 { 31-- 322.33.0 33 34