[gnome-software/1744-software-remembers-past-install-intent] toctou errno



commit ec727549d92416c6502cab9f6886ffe98a09ede3
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Jun 1 12:12:34 2022 +0000

    toctou errno

 lib/gs-plugin-loader.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 89e26f27b..40b3dc148 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -1484,8 +1484,7 @@ save_install_queue (GsPluginLoader *plugin_loader)
                                 "install-queue",
                                 NULL);
        if (s->len == 0) {
-               if (g_file_test (file, G_FILE_TEST_EXISTS) &&
-                   g_unlink (file) == -1) {
+               if (g_unlink (file) == -1 && errno != ENOENT) {
                        gint errn = errno;
                        g_warning ("Failed to unlink '%s': %s", file, g_strerror (errn));
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]