2
Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3
Copyright (C) 2005- The University of Notre Dame
4
This software is distributed under the GNU General Public License.
5
See the file COPYING for details.
13
#include "ftsh_error.h"
14
#include "stringtools.h"
16
struct sigaction old_int_handler;
17
struct sigaction old_hup_handler;
18
struct sigaction old_quit_handler;
19
struct sigaction old_term_handler;
21
static int cancel_signal = 0;
23
static void cancel_handler( int sig )
25
ftsh_error(FTSH_ERROR_PROCESS,0,"received signal %d",sig);
35
sa.sa_handler = cancel_handler;
39
sigaction(SIGINT,&sa,&old_int_handler);
40
sigaction(SIGHUP,&sa,&old_hup_handler);
41
sigaction(SIGQUIT,&sa,&old_quit_handler);
42
sigaction(SIGTERM,&sa,&old_term_handler);
47
sigaction(SIGINT,&old_int_handler,0);
48
sigaction(SIGHUP,&old_int_handler,0);
49
sigaction(SIGQUIT,&old_int_handler,0);
50
sigaction(SIGTERM,&old_int_handler,0);
51
if(cancel_signal!=0) kill(getpid(),cancel_signal);
56
return cancel_signal!=0;