[glib/glib-2-70: 2/18] glocalfile: Fix g_stat return value not being checked




commit 7b582a9993aacfff074cb91187ad406c7755f01b
Author: Egor Bychin <e bychin drweb com>
Date:   Mon Oct 11 13:55:17 2021 +0300

    glocalfile: Fix g_stat return value not being checked

 gio/glocalfile.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index 0d4a44fd9..da38adea7 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -2011,7 +2011,16 @@ g_local_file_trash (GFile         *file,
        * trying to rename across a filesystem boundary, which doesn't work. So
        * we use g_stat here instead of g_lstat, to know where the symlink
        * points to. */
-      g_stat (path, &file_stat);
+      if (g_stat (path, &file_stat))
+       {
+         errsv = errno;
+         g_free (path);
+
+         g_set_io_error (error,
+                         _("Error trashing file %s: %s"),
+                         file, errsv);
+         return FALSE;
+       }
       g_free (path);
     }
 


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