From 8e64d0d3cc1de32ba845fbe1c4a5a16484352fa9 Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Mon, 26 Jun 2000 17:20:38 +0000 Subject: [PATCH] Fixed the signal handling for x11 targets, specificly -x11.. (Yes, this required a change in the glx target, don't ask) --- source/context_x11.c | 24 +++++++++++++++--------- source/vid_glx.c | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/source/context_x11.c b/source/context_x11.c index b0d4fe0..01757bb 100644 --- a/source/context_x11.c +++ b/source/context_x11.c @@ -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 ); diff --git a/source/vid_glx.c b/source/vid_glx.c index 70b57d3..9ccfa05 100644 --- a/source/vid_glx.c +++ b/source/vid_glx.c @@ -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();