More signals fixes &c. (Now it seems to work)

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@572 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2010-05-18 16:32:04 +00:00
parent eb91e63f77
commit 16dfad48a4
3 changed files with 10 additions and 5 deletions

View File

@ -2277,7 +2277,6 @@ runmenuloop(struct dg_menu *menu)
ban.lines = NULL; ban.lines = NULL;
ban.len = 0; ban.len = 0;
idle_alarm_set_enabled(1);
loadbanner(menu->banner_fn, &ban); loadbanner(menu->banner_fn, &ban);
while (1) { while (1) {
if (doclear) { if (doclear) {
@ -2545,11 +2544,15 @@ main (int argc, char** argv)
initcurses (); initcurses ();
term_resize_check(); term_resize_check();
idle_alarm_set_enabled(1);
while (1) { while (1) {
if (runmenuloop(dgl_find_menu(loggedin ? "mainmenu_user" : "mainmenu_anon"))) if (runmenuloop(dgl_find_menu(loggedin ? "mainmenu_user" : "mainmenu_anon")))
break; break;
} }
idle_alarm_set_enabled(0);
/* NOW we can safely kill this */ /* NOW we can safely kill this */
freefile (); freefile ();

View File

@ -273,14 +273,13 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
debug_write("exec-command fork failed"); debug_write("exec-command fork failed");
graceful_exit(114); graceful_exit(114);
} else if (child == 0) { } else if (child == 0) {
signals_block();
execvp(p1, myargv); execvp(p1, myargv);
signals_release();
exit(0); exit(0);
} else } else
waitpid(child, NULL, 0); waitpid(child, NULL, 0);
idle_alarm_set_enabled(1); idle_alarm_set_enabled(1);
initcurses(); initcurses();
clear();
refresh(); refresh();
check_retard(1); check_retard(1);
} }
@ -380,6 +379,8 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
setproctitle ("%s", me->username); setproctitle ("%s", me->username);
initcurses (); initcurses ();
clear();
refresh();
check_retard(1); /* reset retard counter */ check_retard(1); /* reset retard counter */
} }
break; break;

View File

@ -239,16 +239,16 @@ finish (int sig)
if (die) if (die)
{ {
if (wait_for_menu && input_child) if (input_child)
{ {
// Need to kill the child that's writing input to pty. // Need to kill the child that's writing input to pty.
kill(input_child, SIGTERM); kill(input_child, SIGTERM);
while ((pid = wait3(&status, WNOHANG, 0)) > 0); while ((pid = wait3(&status, WNOHANG, 0)) > 0);
wait_for_menu = 0;
} }
else else
done (); done ();
} }
wait_for_menu = 0;
} }
void void
@ -408,4 +408,5 @@ remove_ipfile (void)
free(ipfile); free(ipfile);
ipfile = NULL; ipfile = NULL;
} }
signal(SIGALRM, SIG_IGN);
} }