From 8f460d48b543778d839b96b63494174a43178105 Mon Sep 17 00:00:00 2001 From: Nate Straz Date: Sat, 17 Feb 2007 19:12:09 +0000 Subject: We need to reset the signal handlers and sigmask so the raise() works. --- qarsh.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/qarsh.c b/qarsh.c index bcbd68c..dad1263 100644 --- a/qarsh.c +++ b/qarsh.c @@ -129,6 +129,26 @@ setup_signals(void) } } +void +reset_signals(void) +{ + struct sigaction sa; + sigset_t sigmask; + int i, n; + + n = sizeof sigs_to_propogate / sizeof *sigs_to_propogate; + sigemptyset(&sigmask); + for (i = 0; i < n; i++) { + sigaddset(&sigmask, sigs_to_propogate[i]); + } + sigprocmask(SIG_UNBLOCK, &sigmask, &pselect_sigmask); + sa.sa_handler = SIG_DFL; + sa.sa_mask = sigmask; + for (i = 0; i < n; i++) { + signal(sigs_to_propogate[i], SIG_DFL); + } +} + void set_remote_user(char *user, char *group) { @@ -490,6 +510,7 @@ again: free(args); /* If the remote cmd was killed, we need to be killed too */ if (WIFSIGNALED(ret)) { + reset_signals(); raise(WTERMSIG(ret)); } /* Otherwise we need to exit with the same exit status */ -- cgit