From 948847a2f8fb470af5f5f22e0b04b88f6a481cdc Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 22 May 2023 21:57:38 -0700 Subject: [PATCH] unix: Restore old handler when returning MultipleHandlers --- src/platform/unix/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/unix/mod.rs b/src/platform/unix/mod.rs index eb93677..ba9531c 100644 --- a/src/platform/unix/mod.rs +++ b/src/platform/unix/mod.rs @@ -114,6 +114,7 @@ pub unsafe fn init_os_handler() -> Result<(), Error> { Err(e) => return Err(close_pipe(e)), }; if sigint_old.handler() != signal::SigHandler::SigDfl { + signal::sigaction(signal::Signal::SIGINT, &sigint_old).unwrap(); return Err(close_pipe(nix::Error::EEXIST)); } @@ -128,6 +129,7 @@ pub unsafe fn init_os_handler() -> Result<(), Error> { }; if sigterm_old.handler() != signal::SigHandler::SigDfl { signal::sigaction(signal::Signal::SIGINT, &sigint_old).unwrap(); + signal::sigaction(signal::Signal::SIGTERM, &sigterm_old).unwrap(); return Err(close_pipe(nix::Error::EEXIST)); } let sighup_old = match signal::sigaction(signal::Signal::SIGHUP, &new_action) { @@ -141,6 +143,7 @@ pub unsafe fn init_os_handler() -> Result<(), Error> { if sighup_old.handler() != signal::SigHandler::SigDfl { signal::sigaction(signal::Signal::SIGINT, &sigint_old).unwrap(); signal::sigaction(signal::Signal::SIGTERM, &sigterm_old).unwrap(); + signal::sigaction(signal::Signal::SIGHUP, &sighup_old).unwrap(); return Err(close_pipe(nix::Error::EEXIST)); } }