From 0570bd953cf3ecd1b58c192a015a6f0d46423852 Mon Sep 17 00:00:00 2001 From: Nathan Straz Date: Mon, 16 Sep 2013 16:19:15 -0400 Subject: Only check if stdin is a tty once --- qarsh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- cgit