diff options
author | Ray Strode <rstrode@redhat.com> | 2015-03-09 10:48:18 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2015-03-09 10:52:12 -0400 |
commit | 355d1ca947c219d2d87d30b60b0690f474a7adb7 (patch) | |
tree | 96aeed9ae24b11fce763128d56e8b3a8131c9ec4 | |
parent | e30fa72ef3f0fb92182882d1a68237447c24e40b (diff) | |
download | gnome-session-355d1ca947c219d2d87d30b60b0690f474a7adb7.tar.gz |
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
-rw-r--r-- | 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 7a2e831b..884cc435 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); } |