[Pkg-utopia-maintainers] Bug#639754: [upower]

Francesco Muzio muziofg at gmail.com
Wed Aug 31 20:55:41 UTC 2011


Package: upower
Version: 0.9.12-1
Tags: patch

maybe I have found the problem and the solution.

In the function up_backend_supports_sleep_state() the returnet value of 
g_spawn_command_line_sync() overwrite always the return value (wich is 
default FALSE) with a default TRUE value.

This value is always TRUE because /usr/bin/pm-is-supported exists (the 
case of non existent pm-is-supported is already managed after the 
valutation of retInt

So I have added a retInt variable who store the returned value of 
g_spawn_command_line_sync()  and for his evaluation.

The patch wich I propose is written below, I hope it's safe, correct and 
applicable at the source code


--- src/linux/up-backend_old.c  2011-08-31 22:11:23.000000000 +0200
+++ src/linux/up-backend.c      2011-08-31 22:14:30.000000000 +0200
@@ -348,6 +348,7 @@

   up_backend_supports_sleep_state (const gchar *state)
  {
         gboolean ret = FALSE;
+       gboolean retInt;
         gchar *command;
         GError *error = NULL;
         gint exit_status;
@@ -355,8 +356,8 @@
         /* run script from pm-utils */
         command = g_strdup_printf ("/usr/bin/pm-is-supported --%s", state);
         g_debug ("excuting command: %s", command);
-       ret = g_spawn_command_line_sync (command, NULL, NULL, 
&exit_status, &error);
-       if (!ret) {
+       retInt = g_spawn_command_line_sync (command, NULL, NULL, 
&exit_status, &error);
+       if (!retInt) {
                 g_warning ("failed to run script: %s", error->message);
                 g_error_free (error);
                 goto out;







More information about the Pkg-utopia-maintainers mailing list