set signal handlers only if NG_BACKTRACE is set

This commit is contained in:
Matthias Hochsteger 2020-07-15 16:21:51 +02:00
parent 7058732e23
commit e17aa88cad

View File

@ -217,9 +217,12 @@ static void ngcore_signal_handler(int sig)
// register signal handler when library is loaded // register signal handler when library is loaded
static bool dummy = []() static bool dummy = []()
{ {
if(getenv("NG_BACKTRACE"))
{
signal(SIGABRT, ngcore_signal_handler); signal(SIGABRT, ngcore_signal_handler);
signal(SIGILL, ngcore_signal_handler); signal(SIGILL, ngcore_signal_handler);
signal(SIGSEGV, ngcore_signal_handler); signal(SIGSEGV, ngcore_signal_handler);
}
return true; return true;
}(); }();