summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNate Straz <nstraz@redhat.com>2007-02-17 19:12:09 +0000
committerNathan Straz <nstraz@redhat.com>2008-09-23 09:37:47 -0400
commit8f460d48b543778d839b96b63494174a43178105 (patch)
treea3cc4fc86c07c07d924eef9532a1c188e7112c3d
parentc26d25db53aad579ece49e112c0476cfebdc3923 (diff)
downloadqarsh-8f460d48b543778d839b96b63494174a43178105.zip
qarsh-8f460d48b543778d839b96b63494174a43178105.tar.gz
qarsh-8f460d48b543778d839b96b63494174a43178105.tar.xz
We need to reset the signal handlers and sigmask so the raise() works.
-rw-r--r--qarsh.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/qarsh.c b/qarsh.c
index bcbd68c..dad1263 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -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 */