[gnome-session] fail-whale: fail if the fail whale fails



commit 355d1ca947c219d2d87d30b60b0690f474a7adb7
Author: Ray Strode <rstrode redhat com>
Date:   Mon Mar 9 10:48:18 2015 -0400

    fail-whale: fail if the fail whale fails
    
    If we don't have a wayland session then we don't have a way
    to show the fail whale.  If we don't have a way to show the
    fail whale, then we should just die.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745707

 gnome-session/gsm-fail-whale.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/gnome-session/gsm-fail-whale.c b/gnome-session/gsm-fail-whale.c
index 7a2e831..884cc43 100644
--- a/gnome-session/gsm-fail-whale.c
+++ b/gnome-session/gsm-fail-whale.c
@@ -18,11 +18,20 @@
 
 #include <config.h>
 
+#include <signal.h>
+#include <stdlib.h>
+
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 
 #include "gsm-fail-whale.h"
 
+static void
+on_fail_whale_failed (void)
+{
+        raise (SIGTERM);
+}
+
 void
 gsm_fail_whale_dialog_we_failed  (gboolean            debug_mode,
                                   gboolean            allow_logout,
@@ -30,6 +39,7 @@ gsm_fail_whale_dialog_we_failed  (gboolean            debug_mode,
 {
         gint i;
         gchar *argv[5];
+        GPid  pid;
 
         i = 0;
         argv[i++] = LIBEXECDIR "/gnome-session-failed";
@@ -41,5 +51,11 @@ gsm_fail_whale_dialog_we_failed  (gboolean            debug_mode,
                 argv[i++] = "--extensions";
         argv[i++] = NULL;
 
-        g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL);
+        if (!g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, &pid, NULL)) {
+                exit (1);
+        }
+
+        g_child_watch_add (pid,
+                           (GChildWatchFunc)on_fail_whale_failed,
+                           NULL);
 }


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