summaryrefslogtreecommitdiff
path: root/daemon/slave.c
diff options
context:
space:
mode:
authorErdal Ronahi <erdal.ronahi@gmail.com>2005-10-28 02:19:38 +0000
committerBrian Cameron <bcameron@src.gnome.org>2005-10-28 02:19:38 +0000
commita4063b36674ad8187e8c8c334455934dafbb1c8f (patch)
tree2a717377f4c45b2eb33b041d0676249bf4491411 /daemon/slave.c
parent2bd49fe98d3a2b456a13f082a1a2a1793aab7764 (diff)
downloadgdm-a4063b36674ad8187e8c8c334455934dafbb1c8f.tar.gz
Fix race condition where the d variable wasn't being set until after the
2005-10-27 Erdal Ronahi <erdal.ronahi@gmail.com> * daemon/slave.c: Fix race condition where the d variable wasn't being set until after the signal handlers, and the signal handlers make use of this variable. Now set it before to ensure it is set whenever a signal might be received. Issue pointed out by Simon Bowden on gdm-list@gnome.org
Diffstat (limited to 'daemon/slave.c')
-rw-r--r--daemon/slave.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/daemon/slave.c b/daemon/slave.c
index aef2b3fe..889bbb3f 100644
--- a/daemon/slave.c
+++ b/daemon/slave.c
@@ -88,7 +88,7 @@
#include "cookie.h"
/* Some per slave globals */
-static GdmDisplay *d;
+static GdmDisplay *d = 0;
static gchar *login = NULL;
static gboolean greet = FALSE;
static gboolean configurator = FALSE;
@@ -765,6 +765,13 @@ gdm_slave_start (GdmDisplay *display)
#endif /* SIGXFSZ */
sigset_t mask;
+ /*
+ * Set d global to display before setting signal handlers,
+ * since the signal handlers use the d value. Avoids a
+ * race condition.
+ */
+ d = display;
+
/* Ignore SIGUSR1/SIGPIPE, and especially ignore it
before the Setjmp */
gdm_signal_ignore (SIGUSR1);
@@ -1296,8 +1303,6 @@ gdm_slave_run (GdmDisplay *display)
gint openretries = 0;
gint maxtries = 0;
- d = display;
-
gdm_random_tick ();
if (d->sleep_before_run > 0) {