diff options
-rw-r--r-- | qarsh.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -130,6 +130,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) { struct qa_packet *qp; @@ -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 */ |