summaryrefslogtreecommitdiffstats
path: root/CRT.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-09-10 00:17:59 +0200
committercgzones <cgzones@googlemail.com>2020-09-17 21:54:21 +0200
commit5d4061732f25863d78cca06968cd938ae468b8bf (patch)
treef92c46629413216edf6af1aa034c2d704b0ed01b /CRT.c
parent00665e2a2b9c6efca6cd1f1dbaca0a91ccb31534 (diff)
Allow third party sigsegv handler
For example from sanitizers.
Diffstat (limited to 'CRT.c')
-rw-r--r--CRT.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/CRT.c b/CRT.c
index 7776c4e7..3aea895e 100644
--- a/CRT.c
+++ b/CRT.c
@@ -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);

© 2014-2024 Faster IT GmbH | imprint | privacy policy