summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Cameron <Brian.Cameron@sun.com>2005-10-06 19:47:12 +0000
committerBrian Cameron <bcameron@src.gnome.org>2005-10-06 19:47:12 +0000
commit8e5f7d8b9d064e13bb98506a7f0f3ef246a235d8 (patch)
tree416c4a3fd01c952383dc4bcc9db5e4bc50bb1bd5
parent678d08b1906742bb8ade8fe7335f6f4fcc5c72d8 (diff)
downloadgdm-8e5f7d8b9d064e13bb98506a7f0f3ef246a235d8.tar.gz
Fix problem with PostSession script not always getting executed when user
2005-10-06 Brian Cameron <Brian.Cameron@sun.com> * daemon/slave.c: Fix problem with PostSession script not always getting executed when user kills the Xserver with ctl-alt-backspace. This is caused because an xioerror is generated by whack clients and this xioerror needs to be ignored for PostSession to be processed. This problem tended not to manifest in GDM 2.6 because the introduction of the whack clients call made the xioerror get generated earlier. However, it was still a race condition and this fix ensures that the xioerror will not cause the slave to ever exit too early. Fixes bug #152906. Patch provided by Jerry G. DeLapp <jgd@lanl.gov>
-rw-r--r--ChangeLog18
-rw-r--r--daemon/slave.c34
2 files changed, 51 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 35479aec..611a3b99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2005-10-06 Brian Cameron <Brian.Cameron@sun.com>
+
+ * daemon/slave.c: Fix problem with PostSession
+ script not always getting executed when user
+ kills the Xserver with ctl-alt-backspace.
+ This is caused because an xioerror is generated
+ by whack clients and this xioerror needs to be
+ ignored for PostSession to be processed. This
+ problem tended not to manifest in GDM 2.6
+ because the introduction of the whack clients
+ call made the xioerror get generated earlier.
+ However, it was still a race condition and
+ this fix ensures that the xioerror will not
+ cause the slave to ever exit too early.
+ Fixes bug #152906. Patch provided by Jerry
+ G. DeLapp <jgd@lanl.gov>
+ * AUTHORS: Update AUTHORS file.
+
2005-10-05 Brian Cameron <Brian.Cameron@sun.com>
* acconfig.h, configure.in, config/gdm.conf.in,
diff --git a/daemon/slave.c b/daemon/slave.c
index eadb192f..7c46ef98 100644
--- a/daemon/slave.c
+++ b/daemon/slave.c
@@ -200,6 +200,7 @@ extern gchar *GdmSoundOnLoginFailureFile;
/* Local prototypes */
static gint gdm_slave_xerror_handler (Display *disp, XErrorEvent *evt);
static gint gdm_slave_xioerror_handler (Display *disp);
+static gint gdm_slave_ignore_xioerror_handler (Display *disp);
static void gdm_slave_run (GdmDisplay *display);
static void gdm_slave_wait_for_login (void);
static void gdm_slave_greeter (void);
@@ -233,6 +234,8 @@ static GList *unhandled_notifies = NULL;
/* for signals that want to exit */
static Jmp_buf slave_start_jmp;
+/* for handling xioerror during ctl-alt-bs */
+static Jmp_buf ignore_xioerror_jmp;
static gboolean return_to_slave_start_jmp = FALSE;
static gboolean already_in_slave_start_jmp = FALSE;
static char *slave_start_jmp_error_to_print = NULL;
@@ -4537,8 +4540,29 @@ gdm_slave_session_stop (gboolean run_post_session,
This is to fix #126071, that is kill processes that may still hold open
fd's in the home directory to allow a clean unmount. However note of course
that this is a race. */
+ /* FIX HACK: We will get an xioerror out of whack clients if the user crashed
+ X with ctl-alt-backspace. So, we need to ignore xioerror while we do this.
+ Otherwise, we end up in a longjmp to quick_exit which will prevent things
+ like PostSession scripts from processing */
+ switch (Setjmp (ignore_xioerror_jmp)) {
+ case 0:
+ /* Having just set the jump point, activate the error handler that returns
+ us to the next case */
+ XSetIOErrorHandler (gdm_slave_ignore_xioerror_handler);
+ break;
+ default:
+ /* Here means we saw an xioerror and ignored it. */
+ /* xioerror will cause this to drop back into whack_clients, but I think
+ that is okay because I haven't seen it do so more than once */
+ gdm_debug("gdm_slave_session_stop: back here from xioerror");
+ break;
+ }
+
gdm_server_whack_clients (d->dsp);
+ /* Now we should care about xioerror once again??? */
+ XSetIOErrorHandler (gdm_slave_xioerror_handler);
+
#if defined(_POSIX_PRIORITY_SCHEDULING) && defined(HAVE_SCHED_YIELD)
/* let the other processes die perhaps or whatnot */
sched_yield ();
@@ -4961,7 +4985,15 @@ gdm_slave_xerror_handler (Display *disp, XErrorEvent *evt)
return (0);
}
-/* We respond to fatal errors by restarting the display */
+/* Ignore fatal X errors when user did ctl-alt-backspace */
+static gint
+gdm_slave_ignore_xioerror_handler (Display *disp)
+{
+ gdm_debug ("Fatal X error detected. Ignoring same during session shutdown.");
+ Longjmp(ignore_xioerror_jmp, 1);
+}
+
+/* We usually respond to fatal errors by restarting the display */
static gint
gdm_slave_xioerror_handler (Display *disp)
{