[gnome-flashback] system-indicators: log error if g_file_replace_contents fails



commit 2c096e7ba3cbcf808ce3c8f4d74b93183eb78e6c
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Mar 16 21:46:47 2021 +0200

    system-indicators: log error if g_file_replace_contents fails
    
    Coverity CID: #1502687

 system-indicators/si-input-sources.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/system-indicators/si-input-sources.c b/system-indicators/si-input-sources.c
index bca49e4..d388f9d 100644
--- a/system-indicators/si-input-sources.c
+++ b/system-indicators/si-input-sources.c
@@ -280,6 +280,7 @@ ensure_file_exists (const char *icon_theme_path,
   GFile *file;
   GFile *parent;
   GString *svg;
+  GError *error;
 
   filename = g_strdup_printf ("%s.svg", icon_name);
   path = g_build_filename (icon_theme_path,
@@ -311,15 +312,21 @@ ensure_file_exists (const char *icon_theme_path,
                       symbolic);
 
   g_file_make_directory_with_parents (parent, NULL, NULL);
-  g_file_replace_contents (file,
-                           svg->str,
-                           svg->len,
-                           NULL,
-                           FALSE,
-                           G_FILE_CREATE_NONE,
-                           NULL,
-                           NULL,
-                           NULL);
+
+  error = NULL;
+  if (!g_file_replace_contents (file,
+                                svg->str,
+                                svg->len,
+                                NULL,
+                                FALSE,
+                                G_FILE_CREATE_NONE,
+                                NULL,
+                                NULL,
+                                &error))
+    {
+      g_warning ("%s", error->message);
+      g_clear_error (&error);
+    }
 
   utime (icon_theme_path, NULL);
   gtk_icon_theme_rescan_if_needed (gtk_icon_theme_get_default ());


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