[gnome-settings-daemon] power: Correctly check for helper exit status



commit 8c61c54ba6248891541d5d849d1d9871ad3c4940
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Sep 7 16:31:13 2011 +0100

    power: Correctly check for helper exit status
    
    By using WEXITSTATUS() and not relying solely on the
    return value of g_spawn_command_line_sync().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657364

 plugins/power/gsd-power-manager.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 80aba9d..af10b4f 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -2254,11 +2254,11 @@ backlight_helper_get_value (const gchar *argument, GError **error)
                                          NULL,
                                          &exit_status,
                                          error);
-        if (!ret)
-                goto out;
-
         g_debug ("executed %s retval: %i", command, exit_status);
 
+        if (!ret || WEXITSTATUS (exit_status) != 0)
+                goto out;
+
         /* parse */
         value = g_ascii_strtoll (stdout_data, &endptr, 10);
 
@@ -2322,10 +2322,12 @@ backlight_helper_set_value (const gchar *argument,
                                          NULL,
                                          &exit_status,
                                          error);
-        if (!ret)
-                goto out;
 
         g_debug ("executed %s retval: %i", command, exit_status);
+
+        if (!ret || WEXITSTATUS (exit_status) != 0)
+                goto out;
+
 out:
         g_free (command);
         return ret;



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