From eb91e63f77a881d6769a22dff3944de986140a78 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 16 May 2010 19:14:35 +0000 Subject: [PATCH] More signal handling, this time for when running the game. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@571 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- dgl-common.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/dgl-common.c b/dgl-common.c index 383e229..4e3bd3f 100644 --- a/dgl-common.c +++ b/dgl-common.c @@ -346,7 +346,6 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me) clear(); refresh(); endwin (); - signal(SIGWINCH, SIG_DFL); /* first run the generic "do these when a game is started" commands */ dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_GAMESTART], userchoice, me); @@ -360,17 +359,24 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me) myconfig[userchoice]->bin_args[i] = tmpstr; } - signals_block(); + signal(SIGWINCH, SIG_DFL); + signal(SIGINT, SIG_DFL); + signal(SIGQUIT, SIG_DFL); + signal(SIGTERM, SIG_DFL); idle_alarm_set_enabled(0); /* launch program */ ttyrec_main (userchoice, me->username, dgl_format_str(userchoice, me, myconfig[userchoice]->ttyrecdir, NULL), gen_ttyrec_filename()); - - /* lastly, run the generic "do these when a game is left" commands */ - dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_GAMEEND], userchoice, me); idle_alarm_set_enabled(1); - signals_release(); + /* lastly, run the generic "do these when a game is left" commands */ + signal (SIGHUP, catch_sighup); + signal (SIGINT, catch_sighup); + signal (SIGQUIT, catch_sighup); + signal (SIGTERM, catch_sighup); + signal(SIGWINCH, sigwinch_func); + + dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_GAMEEND], userchoice, me); setproctitle ("%s", me->username); initcurses ();