diff options
author | Nathan Straz <nstraz@redhat.com> | 2013-09-16 16:19:15 -0400 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2013-09-16 16:19:15 -0400 |
commit | 0570bd953cf3ecd1b58c192a015a6f0d46423852 (patch) | |
tree | eca4111d463d99f795d52a306ac6dfbdf2cd018a | |
parent | 806ec3c06915b19c3ab6bb3cb8e1e146bfba5c29 (diff) | |
download | qarsh-0570bd953cf3ecd1b58c192a015a6f0d46423852.tar.gz qarsh-0570bd953cf3ecd1b58c192a015a6f0d46423852.tar.xz qarsh-0570bd953cf3ecd1b58c192a015a6f0d46423852.zip |
Only check if stdin is a tty once
-rw-r--r-- | qarsh.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |