1
0
Fork 0
forked from wry/wry

compositor: reset all signals during startup

This commit is contained in:
Julian Orth 2025-04-26 19:52:05 +02:00
parent 456457eade
commit fdfc20452f
3 changed files with 16 additions and 11 deletions

View file

@ -339,7 +339,9 @@ impl Forker {
}
set_process_name("the ol' forker");
setup_deathsig(ppid);
reset_signals();
unsafe {
c::signal(c::SIGCHLD, c::SIG_IGN);
}
let socket = Rc::new(setup_fds(socket));
std::panic::set_hook({
let socket = socket.raw();
@ -569,16 +571,6 @@ fn setup_fds(mut socket: OwnedFd) -> OwnedFd {
socket
}
fn reset_signals() {
const NSIG: c::c_int = 64;
unsafe {
for sig in 1..=NSIG {
c::signal(sig, c::SIG_DFL);
}
c::signal(c::SIGCHLD, c::SIG_IGN);
}
}
fn setup_deathsig(ppid: c::pid_t) {
unsafe {
let res = c::prctl(c::PR_SET_PDEATHSIG, c::SIGKILL as c::c_ulong);