diff options
author | Nate Straz <nstraz@redhat.com> | 2007-02-17 19:12:09 +0000 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2008-09-23 09:37:47 -0400 |
commit | 8f460d48b543778d839b96b63494174a43178105 (patch) | |
tree | a3cc4fc86c07c07d924eef9532a1c188e7112c3d | |
parent | c26d25db53aad579ece49e112c0476cfebdc3923 (diff) | |
download | qarsh-8f460d48b543778d839b96b63494174a43178105.tar.gz qarsh-8f460d48b543778d839b96b63494174a43178105.tar.xz qarsh-8f460d48b543778d839b96b63494174a43178105.zip |
We need to reset the signal handlers and sigmask so the raise() works.
-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 */ |