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.len = 0;
idle_alarm_set_enabled(1);
loadbanner(menu->banner_fn, &ban);
while (1) {
if (doclear) {
@ -2545,11 +2544,15 @@ main (int argc, char** argv)
initcurses ();
term_resize_check();
idle_alarm_set_enabled(1);
while (1) {
if (runmenuloop(dgl_find_menu(loggedin ? "mainmenu_user" : "mainmenu_anon")))
break;
}
idle_alarm_set_enabled(0);
/* NOW we can safely kill this */
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");
graceful_exit(114);
} else if (child == 0) {
signals_block();
execvp(p1, myargv);
signals_release();
exit(0);
} else
waitpid(child, NULL, 0);
idle_alarm_set_enabled(1);
initcurses();
clear();
refresh();
check_retard(1);
}
@ -380,6 +379,8 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
setproctitle ("%s", me->username);
initcurses ();
clear();
refresh();
check_retard(1); /* reset retard counter */
}
break;

View File

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