[gnome-session] process-helper: Use g_spawn_check_exit_status



commit db422c67df5d6f428aaf56fd2832653b1fd6b2ff
Author: Colin Walters <walters verbum org>
Date:   Tue Jul 10 11:41:49 2012 -0400

    process-helper: Use g_spawn_check_exit_status
    
    This removes a lot of redundant code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679713

 configure.ac                       |    2 +-
 gnome-session/gsm-process-helper.c |   21 ++-------------------
 2 files changed, 3 insertions(+), 20 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4adf0e2..a8b900a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,7 +33,7 @@ if test "x$enable_deprecation_flags" = "xyes"; then
    AC_SUBST([DISABLE_DEPRECATED_CFLAGS])
 fi
 
-GLIB_REQUIRED=2.28.0
+GLIB_REQUIRED=2.33.3
 GTK3_REQUIRED=2.90.7
 DBUS_GLIB_REQUIRED=0.76
 UPOWER_REQUIRED=0.9.0
diff --git a/gnome-session/gsm-process-helper.c b/gnome-session/gsm-process-helper.c
index da45800..d7f3aae 100644
--- a/gnome-session/gsm-process-helper.c
+++ b/gnome-session/gsm-process-helper.c
@@ -113,25 +113,8 @@ gsm_process_helper (const char   *command_line,
                                      G_IO_CHANNEL_ERROR_FAILED,
                                      "Timed out");
         } else {
-                if (WIFEXITED (helper->status)) {
-                        if (WEXITSTATUS (helper->status) == 0)
-                                ret = TRUE;
-                        else
-                                g_set_error (error,
-                                             G_IO_CHANNEL_ERROR,
-                                             G_IO_CHANNEL_ERROR_FAILED,
-                                             _("Exited with code %d"), WEXITSTATUS (helper->status));
-                } else if (WIFSIGNALED (helper->status)) {
-                        g_set_error (error,
-                                     G_IO_CHANNEL_ERROR,
-                                     G_IO_CHANNEL_ERROR_FAILED,
-                                     _("Killed by signal %d"), WTERMSIG (helper->status));
-                } else if (WIFSTOPPED (helper->status)) {
-                        g_set_error (error,
-                                     G_IO_CHANNEL_ERROR,
-                                     G_IO_CHANNEL_ERROR_FAILED,
-                                     _("Stopped by signal %d"), WSTOPSIG (helper->status));
-                }
+                if (g_spawn_check_exit_status (helper->status, error))
+                        ret = TRUE;
         }
 
         if (helper->loop) {



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