summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2013-09-16 16:19:15 -0400
committerNathan Straz <nstraz@redhat.com>2013-09-16 16:19:15 -0400
commit0570bd953cf3ecd1b58c192a015a6f0d46423852 (patch)
treeeca4111d463d99f795d52a306ac6dfbdf2cd018a
parent806ec3c06915b19c3ab6bb3cb8e1e146bfba5c29 (diff)
downloadqarsh-0570bd953cf3ecd1b58c192a015a6f0d46423852.tar.gz
qarsh-0570bd953cf3ecd1b58c192a015a6f0d46423852.tar.xz
qarsh-0570bd953cf3ecd1b58c192a015a6f0d46423852.zip
Only check if stdin is a tty once
-rw-r--r--qarsh.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/qarsh.c b/qarsh.c
index 6d02762..c713380 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -193,6 +193,7 @@ run_remote_cmd(char *cmdline)
int nbytes;
struct timespec timeout;
short cmd_finished;
+ short stdin_isatty = isatty(fileno(stdin));
qp = make_qp_runcmd(cmdline);
send_packet(qarsh_fd, qp);
@@ -225,7 +226,7 @@ run_remote_cmd(char *cmdline)
/* allowed_in is set to -1 when stdin is closed */
if (allowed_in != -1) {
/* close stdin if it is a tty */
- if (isatty(fileno(stdin))) {
+ if (stdin_isatty) {
qp = make_qp_data(0, 0, 0, NULL);
send_packet(qarsh_fd, qp);
qpfree(qp);