[gnome-flashback] common: fix unchecked return value warnings



commit 656344bc089399d6af5ff0882898566a5be74e56
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Mar 5 13:56:21 2022 +0200

    common: fix unchecked return value warnings
    
    Coverity CID: #1502893, #1502892, #1502891

 gnome-flashback/libcommon/gf-bg.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gnome-flashback/libcommon/gf-bg.c b/gnome-flashback/libcommon/gf-bg.c
index 67cb3a9..27e1dca 100644
--- a/gnome-flashback/libcommon/gf-bg.c
+++ b/gnome-flashback/libcommon/gf-bg.c
@@ -291,8 +291,10 @@ cleanup_cache_for_monitor (gchar *cache_dir,
                path = g_build_filename (cache_dir, file, NULL);
                /* purge files with same monitor id */
                if (g_str_has_prefix (file, monitor_prefix) &&
-                   g_file_test (path, G_FILE_TEST_IS_REGULAR))
-                       g_unlink (path);
+                   g_file_test (path, G_FILE_TEST_IS_REGULAR)) {
+                       if (g_unlink (path) != 0)
+                               g_warning ("Failed to delete %s", path);
+               }
 
                g_free (path);
 
@@ -343,7 +345,8 @@ refresh_cache_file (GfBG      *bg,
 
                if (format != NULL) {
                        if (!g_file_test (cache_dir, G_FILE_TEST_IS_DIR)) {
-                               g_mkdir_with_parents (cache_dir, 0700);
+                               if (g_mkdir_with_parents (cache_dir, 0700) != 0)
+                                       g_warning ("Failed to mkdir %s", cache_dir);
                        } else {
                                cleanup_cache_for_monitor (cache_dir, num_monitor);
                        }
@@ -389,7 +392,8 @@ draw_color_area (GfBG         *bg,
         extent.width = gdk_pixbuf_get_width (dest);
         extent.height = gdk_pixbuf_get_height (dest);
 
-        gdk_rectangle_intersect (rect, &extent, rect);
+        if (!gdk_rectangle_intersect (rect, &extent, rect))
+                return;
        
        switch (bg->color_type) {
        case G_DESKTOP_BACKGROUND_SHADING_SOLID:


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