mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-14 21:14:35 +03:00
Allow third party sigsegv handler
For example from sanitizers.
This commit is contained in:

committed by
cgzones

parent
00665e2a2b
commit
5d4061732f
8
CRT.c
8
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);
|
||||
|
Reference in New Issue
Block a user