Commit ae0953b5 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

if child crashed (died of a signal) then log the signal if debug is on

Fri Jul 25 13:06:49 2003  George Lebl <jirka@5z.com>

	* daemon/display.c, daemon/gdm.c: if child crashed (died of a signal)
	  then log the signal if debug is on

	* daemon/gdm.h, daemon/server.c, daemon/slave.[ch]:  The X server
	  quite apparently emits a USR1 on reinit so catch that (apparently
	  I was not seeing this before as USR1 seems to have been blocked
	  during the fun times.)

	* demon/server.c: on exit from an XDMCP display whack all clients
	  to support broken X terminals

	* daemon/slave.c: whack the \n's from some of the GUI messages as
	  that's not needed anymore with gtk2 and in fact sometimes
	  can look like crap.

	* daemon/slave.c: run session_stop before the 10 second session
	  warning and don't run the warning if the server is dead

	* daemon/veriy-pam.c: don't return uninit value if we don't
	  open session or delete secred, return PAM_SUCCESS

	* daemon/gdmthemetester: add -terminate to command line so that
	  I don't keep getting thousands of Xnest windows on my screen
parent 30f9f785
Fri Jul 25 13:06:49 2003 George Lebl <jirka@5z.com>
* daemon/display.c, daemon/gdm.c: if child crashed (died of a signal)
then log the signal if debug is on
* daemon/gdm.h, daemon/server.c, daemon/slave.[ch]: The X server
quite apparently emits a USR1 on reinit so catch that (apparently
I was not seeing this before as USR1 seems to have been blocked
during the fun times.)
* demon/server.c: on exit from an XDMCP display whack all clients
to support broken X terminals
* daemon/slave.c: whack the \n's from some of the GUI messages as
that's not needed anymore with gtk2 and in fact sometimes
can look like crap.
* daemon/slave.c: run session_stop before the 10 second session
warning and don't run the warning if the server is dead
* daemon/veriy-pam.c: don't return uninit value if we don't
open session or delete secred, return PAM_SUCCESS
* daemon/gdmthemetester: add -terminate to command line so that
I don't keep getting thousands of Xnest windows on my screen
Fri Jul 25 03:32:48 2003 George Lebl <jirka@5z.com>
* daemon/display.c: whack unneeded block pushes, when killing child
......
......@@ -344,7 +344,8 @@ wait_again:
}
if (WIFSIGNALED (exitstatus)) {
gdm_debug ("gdm_display_unmanage: Slave crashed, killing its children");
gdm_debug ("gdm_display_unmanage: Slave crashed (signal %d), killing its children",
(int)WTERMSIG (exitstatus));
if (d->sesspid > 1)
kill (-(d->sesspid), SIGTERM);
......
......@@ -1117,14 +1117,17 @@ gdm_cleanup_children (void)
if (WIFEXITED (exitstatus)) {
status = WEXITSTATUS (exitstatus);
crashed = FALSE;
gdm_debug ("gdm_cleanup_children: child %d returned %d", pid, status);
} else {
status = EXIT_SUCCESS;
crashed = TRUE;
if (WIFSIGNALED (exitstatus))
gdm_debug ("gdm_cleanup_children: child %d crashed of signal %d", pid,
(int)WTERMSIG (exitstatus));
else
gdm_debug ("gdm_cleanup_children: child %d crashed", pid);
}
gdm_debug ("gdm_cleanup_children: child %d returned %d%s", pid, status,
crashed ? " (child crashed)" : "");
if (pid == extra_process) {
/* an extra process died, yay! */
extra_process = 0;
......@@ -1312,6 +1315,7 @@ start_autopsy:
break;
case DISPLAY_XFAILED: /* X sucks */
gdm_debug ("X failed!");
/* inform about error if needed */
if (d->socket_conn != NULL) {
GdmConnection *conn = d->socket_conn;
......@@ -1359,7 +1363,7 @@ start_autopsy:
case DISPLAY_REMANAGE: /* Remanage display */
default:
gdm_debug ("gdm_child_action: Slave process returned %d", status);
gdm_debug ("gdm_child_action: In remanage");
/* inform about error if needed */
if (d->socket_conn != NULL) {
......
......@@ -45,7 +45,7 @@
* process exit codes */
#define SERVER_TIMEOUT 2 /* Server didn't start */
#define SERVER_DEAD 250 /* Server stopped */
#define SERVER_STARTED 251 /* Server started but not ready for connections yet */
#define SERVER_PENDING 251 /* Server started but not ready for connections yet */
#define SERVER_RUNNING 252 /* Server running and ready for connections */
#define SERVER_ABORT 253 /* Server failed badly. Suspending display. */
......
......@@ -54,7 +54,6 @@
/* Local prototypes */
static void gdm_server_spawn (GdmDisplay *d, const char *vtarg);
static void gdm_server_usr1_handler (gint);
static void gdm_server_alarm_handler (gint);
static void gdm_server_child_handler (gint);
static char * get_font_path (const char *display);
......@@ -75,6 +74,9 @@ static GdmDisplay *d = NULL;
static gboolean server_signal_notified = FALSE;
static int server_signal_pipe[2];
static void do_server_wait (GdmDisplay *d);
static gboolean setup_server_wait (GdmDisplay *d);
void
gdm_server_whack_lockfile (GdmDisplay *disp)
{
......@@ -140,14 +142,11 @@ jumpback_xioerror_handler (Display *disp)
* but only if the display exists
*/
void
gboolean
gdm_server_reinit (GdmDisplay *disp)
{
int (*old_xerror_handler)(Display *, XErrorEvent *) = NULL;
int (*old_xioerror_handler)(Display *) = NULL;
if (disp == NULL)
return;
return FALSE;
if (disp->servpid <= 0) {
/* Kill our connection if one existed, likely to result
......@@ -156,64 +155,66 @@ gdm_server_reinit (GdmDisplay *disp)
XCloseDisplay (disp->dsp);
disp->dsp = NULL;
}
return;
return FALSE;
}
gdm_debug ("gdm_server_reinit: Server for %s is about to be reinitialized!", disp->name);
/* FIXME: the X server emits a SIGUSR1 so whack the below hack and add a server
wait thingie like during start */
if ( ! setup_server_wait (disp))
return FALSE;
/* Long live Setjmp, DIE DIE DIE XSetIOErrorHandler */
d->servstat = SERVER_PENDING;
if (disp->dsp == NULL) {
gdm_error ("Reiniting server, but don't have a display connection, strange");
if (disp->dsp != NULL) {
int (*old_xerror_handler)(Display *, XErrorEvent *) = NULL;
int (*old_xioerror_handler)(Display *) = NULL;
/* Now whack the server with a SIGHUP */
gdm_sigchld_block_push ();
if (disp->servpid > 1)
kill (disp->servpid, SIGHUP);
gdm_sigchld_block_pop ();
/* a hack we have no way of knowing when the server died */
sleep (1);
return;
}
/* Do note the interaction of this Setjmp and the signal
handlers and the Setjmp in slave.c */
/* Do note the interaction of this Setjmp and the signal
handlers and the Setjmp in slave.c */
/* Long live Setjmp, DIE DIE DIE XSetIOErrorHandler */
if (Setjmp (reinitjmp) == 0) {
/* come here and we'll whack the server and wait to get
an xio error */
old_xerror_handler = XSetErrorHandler (ignore_xerror_handler);
old_xioerror_handler = XSetIOErrorHandler (jumpback_xioerror_handler);
if (Setjmp (reinitjmp) == 0) {
/* come here and we'll whack the server and wait to get
an xio error */
old_xerror_handler = XSetErrorHandler (ignore_xerror_handler);
old_xioerror_handler = XSetIOErrorHandler (jumpback_xioerror_handler);
/* Now whack the server with a SIGHUP */
gdm_sigchld_block_push ();
if (disp->servpid > 1) {
kill (disp->servpid, SIGHUP);
} else {
/* Now whack the server with a SIGHUP */
gdm_sigchld_block_push ();
if (disp->servpid > 1)
kill (disp->servpid, SIGHUP);
else
d->servstat = SERVER_DEAD;
gdm_sigchld_block_pop ();
/* the server is dead, weird */
if (disp->dsp != NULL) {
XCloseDisplay (disp->dsp);
disp->dsp = NULL;
}
sleep (1);
Longjmp (reinitjmp, 1);
}
/* no more display */
disp->dsp = NULL;
XSetErrorHandler (old_xerror_handler);
XSetIOErrorHandler (old_xioerror_handler);
} else {
/* Now whack the server with a SIGHUP */
gdm_sigchld_block_push ();
if (disp->servpid > 1)
kill (disp->servpid, SIGHUP);
else
d->servstat = SERVER_DEAD;
gdm_sigchld_block_pop ();
/* Wait for an xioerror */
for (;;) {
XEvent event;
XNextEvent (disp->dsp, &event);
}
}
/* no more display */
disp->dsp = NULL;
XSetErrorHandler (old_xerror_handler);
XSetIOErrorHandler (old_xioerror_handler);
/* Wait for the SIGUSR1 */
do_server_wait (d);
if (d->servstat == SERVER_RUNNING)
return TRUE;
else
return FALSE;
}
/**
......@@ -233,6 +234,9 @@ gdm_server_stop (GdmDisplay *disp)
/* Kill our connection if one existed */
if (disp->dsp != NULL) {
/* on XDMCP servers first kill everything in sight */
if (disp->type == TYPE_XDMCP)
gdm_server_whack_clients (d);
XCloseDisplay (disp->dsp);
disp->dsp = NULL;
}
......@@ -434,103 +438,25 @@ display_vt (GdmDisplay *disp)
return -1;
}
static void
check_child_status (void)
{
int status;
pid_t pid;
while ((pid = waitpid (-1, &status, WNOHANG)) > 0) {
gdm_debug ("check_child_status: %d died", pid);
if (WIFEXITED (status))
gdm_debug ("check_child_status: %d returned %d",
(int)pid, (int)WEXITSTATUS (status));
if (WIFSIGNALED (status))
gdm_debug ("check_child_status: %d died of %d",
(int)pid, (int)WTERMSIG (status));
if (pid == d->servpid) {
gdm_debug ("check_child_status: Got SIGCHLD from server, "
"server abort");
d->servstat = SERVER_ABORT; /* Server died unexpectedly */
d->servpid = 0;
server_signal_notified = TRUE;
} else if (pid == extra_process) {
/* an extra process died, yay! */
extra_process = 0;
extra_status = status;
}
}
}
/**
* gdm_server_start:
* @disp: Pointer to a GdmDisplay structure
*
* Starts a local X server. Handles retries and fatal errors properly.
*/
static struct sigaction old_svr_wait_chld;
static sigset_t old_svr_wait_mask;
gboolean
gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
int min_flexi_disp, int flexi_retries)
static gboolean
setup_server_wait (GdmDisplay *d)
{
struct sigaction usr1, chld, alrm;
struct sigaction old_chld, old_alrm;
sigset_t mask, oldmask;
int flexi_disp = 20;
char *vtarg = NULL;
int vtfd = -1, vt = -1;
if (disp == NULL)
return FALSE;
d = disp;
/* if an X server exists, wipe it */
gdm_server_stop (d);
/* First clear the VT number */
if (d->type == TYPE_LOCAL ||
d->type == TYPE_FLEXI) {
d->vt = -1;
gdm_slave_send_num (GDM_SOP_VT_NUM, -1);
}
if (SERVER_IS_FLEXI (d) ||
treat_as_flexi) {
flexi_disp = gdm_get_free_display
(MAX (high_display_num + 1, min_flexi_disp) /* start */,
d->server_uid /* server uid */);
g_free (d->name);
d->name = g_strdup_printf (":%d", flexi_disp);
d->dispnum = flexi_disp;
gdm_slave_send_num (GDM_SOP_DISP_NUM, flexi_disp);
}
gdm_debug ("gdm_server_start: %s", d->name);
/* Create new cookie */
if ( ! gdm_auth_secure_display (d))
return FALSE;
gdm_slave_send_string (GDM_SOP_COOKIE, d->cookie);
ve_setenv ("DISPLAY", d->name, TRUE);
struct sigaction usr1, chld;
sigset_t mask;
if (pipe (server_signal_pipe) != 0) {
gdm_error (_("%s: Error opening a pipe: %s"),
"gdm_server_start", strerror (errno));
"setup_server_wait", strerror (errno));
return FALSE;
}
server_signal_notified = FALSE;
/* Catch USR1 from X server */
usr1.sa_handler = gdm_server_usr1_handler;
usr1.sa_flags = SA_RESTART|SA_RESETHAND;
usr1.sa_flags = SA_RESTART;
sigemptyset (&usr1.sa_mask);
if (sigaction (SIGUSR1, &usr1, NULL) < 0) {
......@@ -543,10 +469,10 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
/* Catch CHLD from X server */
chld.sa_handler = gdm_server_child_handler;
chld.sa_flags = SA_RESTART|SA_RESETHAND;
chld.sa_flags = SA_RESTART|SA_NOCLDSTOP;
sigemptyset (&chld.sa_mask);
if (sigaction (SIGCHLD, &chld, &old_chld) < 0) {
if (sigaction (SIGCHLD, &chld, &old_svr_wait_chld) < 0) {
gdm_error (_("%s: Error setting up CHLD signal handler: %s"),
"gdm_server_start", strerror (errno));
signal (SIGUSR1, SIG_IGN);
......@@ -555,73 +481,37 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
return FALSE;
}
/* Catch ALRM from X server */
alrm.sa_handler = gdm_server_alarm_handler;
alrm.sa_flags = SA_RESTART|SA_RESETHAND;
sigemptyset (&alrm.sa_mask);
if (sigaction (SIGALRM, &alrm, &old_alrm) < 0) {
gdm_error (_("%s: Error setting up ALRM signal handler: %s"),
"gdm_server_start", strerror (errno));
signal (SIGUSR1, SIG_IGN);
sigaction (SIGCHLD, &old_chld, NULL);
close (server_signal_pipe[0]);
close (server_signal_pipe[1]);
return FALSE;
}
/* Set signal mask */
sigemptyset (&mask);
sigaddset (&mask, SIGUSR1);
sigaddset (&mask, SIGCHLD);
sigaddset (&mask, SIGALRM);
sigprocmask (SIG_UNBLOCK, &mask, &oldmask);
/* We add a timeout in case the X server fails to start. This
* might happen because X servers take a while to die, close their
* sockets etc. If the old X server isn't completely dead, the new
* one will fail and we'll hang here forever */
/* Only do alarm if server will be run as root */
if (d->server_uid == 0) {
alarm (SERVER_WAIT_ALARM);
}
d->servstat = SERVER_DEAD;
if (d->type == TYPE_LOCAL ||
d->type == TYPE_FLEXI) {
vtarg = gdm_get_empty_vt_argument (&vtfd, &vt);
}
sigprocmask (SIG_UNBLOCK, &mask, &old_svr_wait_mask);
/* fork X server process */
gdm_server_spawn (d, vtarg);
/* we can now use d->handled since that's set up above */
return TRUE;
}
static void
do_server_wait (GdmDisplay *d)
{
/* Wait for X server to send ready signal */
if (d->servstat == SERVER_STARTED) {
if (d->servstat == SERVER_PENDING) {
if (d->server_uid != 0 && ! d->handled) {
alarm (0);
/* FIXME: If not handled, we just don't know, so
* just wait a few seconds and hope things just work,
* fortunately there is no such case yet and probably
* never will, but just for code anality's sake */
sleep (5);
/* In case we got a SIGCHLD */
check_child_status ();
} else if (d->server_uid != 0) {
int i;
alarm (0);
/* FIXME: This is not likely to work in reinit,
but we never reinit Xnest servers nowdays,
so that's fine */
/* if we're running the server as a non-root, we can't
* use USR1 of course, so try openning the display
* as a test, but the */
/* In case we got a SIGCHLD */
check_child_status ();
/* just in case it's set */
ve_unsetenv ("XAUTHORITY");
......@@ -629,7 +519,7 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
for (i = 0;
d->dsp == NULL &&
d->servstat == SERVER_STARTED &&
d->servstat == SERVER_PENDING &&
i < SERVER_WAIT_ALARM;
i++) {
d->dsp = XOpenDisplay (d->name);
......@@ -637,46 +527,130 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
sleep (1);
else
d->servstat = SERVER_RUNNING;
/* In case we got a SIGCHLD */
check_child_status ();
}
if (d->dsp == NULL &&
/* Note: we could have still gotten a SIGCHLD */
d->servstat == SERVER_STARTED) {
d->servstat == SERVER_PENDING) {
d->servstat = SERVER_TIMEOUT;
}
if (d->servpid <= 1) {
d->servstat = SERVER_ABORT;
}
} else {
time_t t = time (NULL);
gdm_debug ("gdm_server_start: Before mainloop waiting for server");
gdm_debug ("do_server_wait: Before mainloop waiting for server");
do {
fd_set rfds;
struct timeval tv;
/* Wait up to SERVER_WAIT_ALARM seconds. */
tv.tv_sec = MAX (1, SERVER_WAIT_ALARM - (time(NULL) - t));
tv.tv_usec = 0;
FD_ZERO (&rfds);
FD_SET (server_signal_pipe[0], &rfds);
if (select (server_signal_pipe[0]+1, &rfds, NULL, NULL, NULL) > 0) {
if (select (server_signal_pipe[0]+1, &rfds, NULL, NULL, &tv) > 0) {
char buf[4];
/* read the Yay! */
read (server_signal_pipe[0], buf, 4);
}
/* In case we got a SIGCHLD */
check_child_status ();
if ( ! server_signal_notified &&
t + SERVER_WAIT_ALARM < time (NULL)) {
gdm_debug ("do_server_wait: Server timeout");
d->servstat = SERVER_TIMEOUT;
server_signal_notified = TRUE;
}
if (d->servpid <= 1) {
d->servstat = SERVER_ABORT;
server_signal_notified = TRUE;
}
} while ( ! server_signal_notified);
gdm_debug ("gdm_server_start: After mainloop waiting for server");
}
}
/* In case we got a SIGCHLD */
check_child_status ();
/* restore default handlers */
signal (SIGUSR1, SIG_IGN);
sigaction (SIGCHLD, &old_svr_wait_chld, NULL);
sigprocmask (SIG_SETMASK, &old_svr_wait_mask, NULL);
close (server_signal_pipe[0]);
close (server_signal_pipe[1]);
}
/**
* gdm_server_start:
* @disp: Pointer to a GdmDisplay structure
*
* Starts a local X server. Handles retries and fatal errors properly.
*/
gboolean
gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
int min_flexi_disp, int flexi_retries)
{
int flexi_disp = 20;
char *vtarg = NULL;
int vtfd = -1, vt = -1;
if (disp == NULL)
return FALSE;
d = disp;
/* if an X server exists, wipe it */
gdm_server_stop (d);
/* First clear the VT number */
if (d->type == TYPE_LOCAL ||
d->type == TYPE_FLEXI) {
d->vt = -1;
gdm_slave_send_num (GDM_SOP_VT_NUM, -1);
}
if (SERVER_IS_FLEXI (d) ||
treat_as_flexi) {
flexi_disp = gdm_get_free_display
(MAX (high_display_num + 1, min_flexi_disp) /* start */,
d->server_uid /* server uid */);
g_free (d->name);
d->name = g_strdup_printf (":%d", flexi_disp);
d->dispnum = flexi_disp;
gdm_slave_send_num (GDM_SOP_DISP_NUM, flexi_disp);
}
gdm_debug ("gdm_server_start: %s", d->name);
/* Create new cookie */
if ( ! gdm_auth_secure_display (d))
return FALSE;
gdm_slave_send_string (GDM_SOP_COOKIE, d->cookie);
ve_setenv ("DISPLAY", d->name, TRUE);
if ( ! setup_server_wait (d))
return FALSE;
d->servstat = SERVER_DEAD;
/* Unset alarm */
if (d->server_uid == 0) {
alarm (0);
if (d->type == TYPE_LOCAL ||
d->type == TYPE_FLEXI) {
vtarg = gdm_get_empty_vt_argument (&vtfd, &vt);
}
/* fork X server process */
gdm_server_spawn (d, vtarg);
/* we can now use d->handled since that's set up above */
do_server_wait (d);
/* If we were holding a vt open for the server, close it now as it has
* already taken the bait. */
if (vtfd > 0)
......@@ -695,16 +669,6 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
case SERVER_RUNNING:
gdm_debug ("gdm_server_start: Completed %s!", d->name);
sigprocmask (SIG_SETMASK, &oldmask, NULL);
/* restore default handlers */
signal (SIGUSR1, SIG_IGN);
sigaction (SIGCHLD, &old_chld, NULL);
sigaction (SIGALRM, &old_alrm, NULL);
close (server_signal_pipe[0]);
close (server_signal_pipe[1]);
if (SERVER_IS_FLEXI (d))
gdm_slave_send_num (GDM_SOP_FLEXI_OK, 0 /* bogus */);
if (d->type == TYPE_LOCAL ||
......@@ -743,19 +707,6 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
/* We will rebake cookies anyway, so wipe these */
gdm_server_wipe_cookies (disp);
sigprocmask (SIG_SETMASK, &oldmask, NULL);
/* In case we got a SIGCHLD */
check_child_status ();
/* restore default handlers */
signal (SIGUSR1, SIG_IGN);
sigaction (SIGCHLD, &old_chld, NULL);
sigaction (SIGALRM, &old_alrm, NULL);
close (server_signal_pipe[0]);
close (server_signal_pipe[1]);
if (disp->type == TYPE_FLEXI_XNEST &&
display_xnest_no_connect (disp)) {
gdm_slave_send_num (GDM_SOP_FLEXI_ERR,
......@@ -989,7 +940,7 @@ gdm_server_resolve_command_line (GdmDisplay *disp,
static void
gdm_server_spawn (GdmDisplay *d, const char *vtarg)
{
struct sigaction ign_signal, dfl_signal;
struct sigaction ign_signal;
sigset_t mask;
gchar **argv = NULL;
char *logfile;
......@@ -1002,7 +953,7 @@ gdm_server_spawn (GdmDisplay *d, const char *vtarg)
return;
}
d->servstat = SERVER_STARTED;
d->servstat = SERVER_PENDING;
gdm_sigchld_block_push ();
......@@ -1035,11 +986,8 @@ gdm_server_spawn (GdmDisplay *d, const char *vtarg)
switch (pid) {
case 0:
alarm (0);
/* Close the XDMCP fd inherited by the daemon process */
if (GdmXdmcp)
gdm_xdmcp_close();
/* the pops whacked mask again */
gdm_unset_signals ();
closelog ();
......@@ -1076,10 +1024,13 @@ gdm_server_spawn (GdmDisplay *d, const char *vtarg)
ign_signal.sa_flags = SA_RESTART;
sigemptyset (&ign_signal.sa_mask);
if (sigaction (SIGUSR1, &ign_signal, NULL) < 0) {
gdm_error (_("%s: Error setting %s to %s"),
"gdm_server_spawn", "USR1", "SIG_IGN");
_exit (SERVER_ABORT);
if (d->server_uid == 0) {
/* only set this if we can actually listen */
if (sigaction (SIGUSR1, &ign_signal, NULL) < 0) {
gdm_error (_("%s: Error setting %s to %s"),
"gdm_server_spawn", "USR1", "SIG_IGN");
_exit (SERVER_ABORT);
}
}
if (sigaction (SIGTTIN, &ign_signal, NULL) < 0) {
gdm_error (_("%s: Error setting %s to %s"),
......@@ -1092,21 +1043,8 @@ gdm_server_spawn (GdmDisplay *d, const char *vtarg)
_exit (SERVER_ABORT);
}
/* And HUP and TERM should be at default */
dfl_signal.sa_handler = SIG_DFL;
dfl_signal.sa_flags = SA_RESTART;
sigemptyset (&dfl_signal.sa_mask);
if (sigaction (SIGHUP, &dfl_signal, NULL) < 0) {
gdm_error (_("%s: Error setting %s to %s"),
"gdm_server_spawn", "HUP", "SIG_DFL");
_exit (SERVER_ABORT);
}
if (sigaction (SIGTERM, &dfl_signal, NULL) < 0) {
gdm_error (_("%s: Error setting %s to %s"),
"gdm_server_spawn", "TERM", "SIG_DFL");
_exit (SERVER_ABORT);
}
/* And HUP and TERM are at SIG_DFL from gdm_unset_signals,
we also have an empty mask and all that fun stuff */
/* unblock signals (especially HUP/TERM/USR1) so that we
* can control the X server */
......@@ -1232,8 +1170,10 @@ gdm_server_usr1_handler (gint sig)
{
gdm_in_signal++;
d->servstat = SERVER_RUNNING; /* Server ready to accept connections */
d->starttime = time (NULL);
if (d->servpid > 1) {
d->servstat = SERVER_RUNNING; /* Server ready to accept connections */
d->starttime = time (NULL);
}
gdm_debug ("gdm_server_usr1_handler: Got SIGUSR1, server running");
......@@ -1245,30 +1185,6 @@ gdm_server_usr1_handler (gint sig)
}
/**
* gdm_server_alarm_handler:
* @sig: Signal value
*
* Server start timeout handler
*/
static void
gdm_server_alarm_handler (gint signal)
{
gdm_in_signal++;
d->servstat = SERVER_TIMEOUT; /* Server didn't start */
gdm_debug ("gdm_server_alarm_handler: Got SIGALRM, server abort");
server_signal_notified = TRUE;
/* this will quit the select */
write (server_signal_pipe[1], "Yay!", 4);
gdm_in_signal--;
}
/**
* gdm_server_child_handler:
* @sig: Signal value
......@@ -1283,6 +1199,9 @@ gdm_server_child_handler (int signal)
gdm_debug ("gdm_server_child_handler: Got SIGCHLD");
/* go to the main child handler */
gdm_slave_child_handler (signal);
/* this will quit the select */