mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 15:41:59 +00:00
[util] Avoid Sys_Shutdown for IO signals
It turns out that calling Sys_Shutdown in the signal handler can cause lockups due to the signal occurring at unsafe times. Fortunately, this is just the IO related signals (INT, HUP, TERM, QUIT) as the others are usually caused by actual errors and should not occur in system code thus timing should not be an issue. However, care will need to be taken when it comes to handling SIGINT or similar for breaking runaway progs code when that time comes.
This commit is contained in:
parent
af56e9242b
commit
7d022db702
1 changed files with 4 additions and 3 deletions
|
@ -932,7 +932,7 @@ signal_handler (int sig)
|
|||
case SIGTERM:
|
||||
signal (SIGINT, SIG_DFL);
|
||||
signal (SIGTERM, SIG_DFL);
|
||||
Sys_Quit ();
|
||||
exit(1);
|
||||
default:
|
||||
if (!setjmp (aiee_abort)) {
|
||||
if (signal_hook)
|
||||
|
@ -986,10 +986,12 @@ signal_handler (int sig, siginfo_t *info, void *ucontext)
|
|||
case SIGINT:
|
||||
case SIGTERM:
|
||||
case SIGHUP:
|
||||
case SIGQUIT:
|
||||
sigaction (SIGHUP, &save_hup, 0);
|
||||
sigaction (SIGINT, &save_int, 0);
|
||||
sigaction (SIGTERM, &save_term, 0);
|
||||
Sys_Quit ();
|
||||
sigaction (SIGQUIT, &save_quit, 0);
|
||||
exit(1);
|
||||
default:
|
||||
if (!sigsetjmp (aiee_abort, 1)) {
|
||||
if (signal_hook)
|
||||
|
@ -998,7 +1000,6 @@ signal_handler (int sig, siginfo_t *info, void *ucontext)
|
|||
}
|
||||
|
||||
if (!recover) {
|
||||
sigaction (SIGQUIT, &save_quit, 0);
|
||||
sigaction (SIGTRAP, &save_trap, 0);
|
||||
sigaction (SIGIOT, &save_iot, 0);
|
||||
sigaction (SIGBUS, &save_bus, 0);
|
||||
|
|
Loading…
Reference in a new issue