summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNate Straz <nstraz@redhat.com>2005-12-08 22:55:32 +0000
committerNathan Straz <nstraz@redhat.com>2008-09-23 09:37:45 -0400
commit7fa30a1f74e98b0b893b7b10e4666cae2b29851d (patch)
tree50f3f589d180de781dfa7814064de1f0fd87a21c
parente3af127ae8f2f7670895cbd511855afc87e1bdd4 (diff)
downloadqarsh-7fa30a1f74e98b0b893b7b10e4666cae2b29851d.zip
qarsh-7fa30a1f74e98b0b893b7b10e4666cae2b29851d.tar.gz
qarsh-7fa30a1f74e98b0b893b7b10e4666cae2b29851d.tar.xz
Instead of ignoring SIGTTIN, ignore stdin if it is a tty.
-rw-r--r--qarsh.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/qarsh.c b/qarsh.c
index 21580f3..2d23989 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -214,7 +214,11 @@ run_remote_cmd(char *cmdline)
FD_SET(qarsh_fd, &readfds);
FD_SET(c_out, &readfds);
FD_SET(c_err, &readfds);
- FD_SET(fileno(stdin), &readfds);
+ /* Ignore stdin if it's a tty, we don't want to deal with
+ * tty i/o if we're a background process */
+ if (!isatty(fileno(stdin))) {
+ FD_SET(fileno(stdin), &readfds);
+ }
/* Setup signal handling stuff so we can propogate signals */
setup_signals();
@@ -419,12 +423,6 @@ main(int argc, char *argv[])
memset(&sa, 0, sizeof sa);
sigemptyset(&sigmask);
sa.sa_mask = sigmask;
- sa.sa_handler = SIG_IGN;
- sigaction(SIGTTIN, &sa, NULL);
-
- memset(&sa, 0, sizeof sa);
- sigemptyset(&sigmask);
- sa.sa_mask = sigmask;
sa.sa_flags = SA_ONESHOT;
sa.sa_handler = sig_alrm_handler;
sigaction(SIGALRM, &sa, NULL);