Block SIGTERM on application shutdown.
This closes a window where SIGTERM will immediate terminate the program,
possibly causing valgrind errors.
@@ -108,6 +108,11 @@ SignalHandler::unhook()
void
SignalHandler::shutdown()
{
+ // Block SIGTERM at shutdown in case valgrind is used.
+ sigset_t signals_to_block;
+ sigemptyset(&signals_to_block);
+ sigaddset(&signals_to_block, SIGTERM);
+ sigprocmask(SIG_BLOCK, &signals_to_block, nullptr);
for (std::vector<SignalHandler*>::iterator
it = _handlers.begin(), ite = _handlers.end();
it != ite;
