Fixed the signal handling for x11 targets, specificly -x11..

(Yes, this required a change in the glx target, don't ask)
This commit is contained in:
Zephaniah E. Hull 2000-06-26 17:20:38 +00:00
parent f17ed670d5
commit 8e64d0d3cc
2 changed files with 16 additions and 10 deletions

View file

@ -119,18 +119,19 @@ x11_process_events(void)
// ========================================================================
static void
TragicDeath(int signal_num)
TragicDeath(int sig)
{
printf("Received signal %d, exiting...\n", sig);
Sys_Quit();
exit(sig);
//XCloseDisplay(x_disp);
//VID_Shutdown();
Sys_Error("This death brought to you by the number %d\n", signal_num);
//Sys_Error("This death brought to you by the number %d\n", signal_num);
}
void
x11_open_display( void )
{
struct sigaction sa;
if ( !x_disp ) {
x_disp = XOpenDisplay( NULL );
if ( !x_disp ) {
@ -138,11 +139,16 @@ x11_open_display( void )
}
// catch signals
sigaction(SIGINT, 0, &sa);
sigaction(SIGTERM, 0, &sa);
sa.sa_handler = TragicDeath;
sigaction(SIGINT, &sa, 0);
sigaction(SIGTERM, &sa, 0);
signal(SIGHUP, TragicDeath);
signal(SIGINT, TragicDeath);
signal(SIGQUIT, TragicDeath);
signal(SIGILL, TragicDeath);
signal(SIGTRAP, TragicDeath);
signal(SIGIOT, TragicDeath);
signal(SIGBUS, TragicDeath);
/* signal(SIGFPE, TragicDeath); */
signal(SIGSEGV, TragicDeath);
signal(SIGTERM, TragicDeath);
// for debugging only
XSynchronize( x_disp, True );

View file

@ -649,7 +649,7 @@ void VID_Init(unsigned char *palette)
vid.aspect = ((float)vid.height / (float)vid.width) * (320.0 / 240.0);
vid.numpages = 2;
InitSig(); // trap evil signals
//InitSig(); // trap evil signals
GL_Init();