[gnome-settings-daemon] power: Add more error checks



commit 0fc947c590ec40f492af16cef5e3de7775ba08ab
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Mar 5 15:14:39 2012 +0000

    power: Add more error checks
    
    Should fix crasher in most unlikely of circumstances. Like the
    kernel giving us crap data.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671268

 plugins/power/gsd-power-manager.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index d0e9d66..b6ca32a 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -2502,6 +2502,16 @@ backlight_helper_get_value (const gchar *argument, GError **error)
                 goto out;
         }
 
+        /* Fetching the value failed, for some other reason */
+        if (value < 0) {
+                g_set_error (error,
+                             GSD_POWER_MANAGER_ERROR,
+                             GSD_POWER_MANAGER_ERROR_FAILED,
+                             "value negative, but helper did not fail: %s",
+                             stdout_data);
+                goto out;
+        }
+
 out:
         g_free (command);
         g_free (stdout_data);



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