Allow third party sigsegv handler

For example from sanitizers.
This commit is contained in:
Christian Göttsche
2020-09-10 00:17:59 +02:00
committed by cgzones
parent 00665e2a2b
commit 5d4061732f
3 changed files with 13 additions and 2 deletions

8
CRT.c
View File

@ -552,6 +552,8 @@ void CRT_restorePrivileges() {
// TODO: pass an instance of Settings instead.
struct sigaction old_sigsegv_handler;
void CRT_init(int delay, int colorScheme, bool allowUnicode) {
initscr();
noecho();
@ -605,7 +607,11 @@ void CRT_init(int delay, int colorScheme, bool allowUnicode) {
}
}
#ifndef DEBUG
signal(11, CRT_handleSIGSEGV);
struct sigaction act;
sigemptyset (&act.sa_mask);
act.sa_flags = (int)SA_RESETHAND;
act.sa_handler = CRT_handleSIGSEGV;
sigaction (SIGSEGV, &act, &old_sigsegv_handler);
#endif
signal(SIGTERM, CRT_handleSIGTERM);
signal(SIGQUIT, CRT_handleSIGTERM);