0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

ircd::exec: Set signal mask for the child process.

This commit is contained in:
Jason Volk 2020-10-22 07:30:36 -07:00
parent f4558a84e6
commit fea49e07df

View file

@ -338,6 +338,16 @@ const noexcept
e->path,
};
#endif
// Ignore SIGINT/SIGQUIT that way the administrator striking ctrl-c or
// ctrl-\ at the console doesn't terminate the child.
#if defined(HAVE_SIGNAL_H)
sigset_t ours;
sys::call(sigemptyset, &ours);
sys::call(sigaddset, &ours, SIGINT);
sys::call(sigaddset, &ours, SIGQUIT);
sys::call(sigprocmask, SIG_BLOCK, &ours, nullptr);
#endif
}
template<class executor>