From: <enl...@li...> - 2003-01-11 20:46:12
|
Enlightenment CVS committal Author : tillsan Project : misc Module : elogin Dir : misc/elogin/src/daemon Modified Files: spawner.c spawner.h Log Message: patch by Ibukun Olumuyiwa <ib...@co...>. He asked me to commit this and it looks good to me. atmos, please review. Bugs fixed: - waitpid() was set to nohang, and it only checked for the elogin and X processes - causing all other child processes to zombie (not good!) - Elogind does not check to make sure elogin is executable before spawning X. This causes X to keep respawning if the elogin executable is inaccessible - Elogin binary location should not be hardwired into the source. Use config.h instead. - Exit status of 0 instead of 1 when x spawn fails =================================================================== RCS file: /cvsroot/enlightenment/misc/elogin/src/daemon/spawner.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- spawner.c 16 Oct 2002 02:05:13 -0000 1.6 +++ spawner.c 11 Jan 2003 20:46:11 -0000 1.7 @@ -99,6 +99,13 @@ /* setup a spawner context */ d = spawner_display_new(); + /* Check to make sure elogin binary is executable */ + if(access(ELOGIN, X_OK)) + { + fprintf(stderr, "Elogin: Fatal Error: Cannot execute elogin binary. Aborting."); + exit(1); + } + /* run X */ spawn_x(); @@ -106,7 +113,7 @@ { free(d); fprintf(stderr, "Elogin: Could not start X server\n"); - exit(0); + exit(1); } /* run elogin */ @@ -161,10 +168,11 @@ int status = 0; pid_t pid; - while ((pid = waitpid(-1, &status, WNOHANG)) > 0) + while ((pid = waitpid(-1, &status, 0)) > 0) { if (pid == d->pid.client) { + printf("INFO: Elogin process died.\n"); if (d->display) { XSync(d->display, False); @@ -175,6 +183,7 @@ } else if (pid == d->pid.x) { + printf("INFO: X Server died.\n"); if (d->display) { XSync(d->display, False); =================================================================== RCS file: /cvsroot/enlightenment/misc/elogin/src/daemon/spawner.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- spawner.h 24 Jul 2002 02:18:08 -0000 1.4 +++ spawner.h 11 Jan 2003 20:46:11 -0000 1.5 @@ -9,11 +9,12 @@ #include <X11/Xlib.h> #include <limits.h> #include <getopt.h> +#include "../config.h" #define X_SERVER "/usr/X11R6/bin/X -terminate -ac -quiet" /* #define X_SERVER "/usr/X11R6/bin/Xnest -terminate -geometry 640x480 -ac -full :1" */ #define X_DISP ":0" /* only used if DISPLAY variable is NOT set */ -#define ELOGIN "/usr/local/bin/elogin" +#define ELOGIN PACKAGE_SOURCE_DIR "/elogin" #define PIDFILE "/var/run/elogind.pid" /* display->status possible values */ |