summaryrefslogtreecommitdiffstats
path: root/qarsh.c
diff options
context:
space:
mode:
Diffstat (limited to 'qarsh.c')
-rw-r--r--qarsh.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/qarsh.c b/qarsh.c
index 5780e95..4df34a0 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -147,6 +147,7 @@ run_remote_cmd(char *cmdline)
struct sockaddr_in caddr;
socklen_t clen;
struct timespec timeout;
+ short cmd_finished;
l_in = bind_any(QARSH_MINPORT);
p_in = getsockport(l_in);
@@ -225,9 +226,15 @@ run_remote_cmd(char *cmdline)
buf = malloc(1024);
memset(buf, 0, 1024);
+ cmd_finished = 0;
for (;;) {
- timeout.tv_sec = 5;
- timeout.tv_nsec = 0;
+ if (cmd_finished) {
+ timeout.tv_sec = 0;
+ timeout.tv_nsec = 0;
+ } else {
+ timeout.tv_sec = 5;
+ timeout.tv_nsec = 0;
+ }
testfds = readfds;
memset(buf, 0, 1024);
@@ -242,6 +249,10 @@ run_remote_cmd(char *cmdline)
qp = NULL;
break;
}
+
+ if (cmd_finished) {
+ break;
+ }
continue;
}
@@ -304,7 +315,8 @@ run_remote_cmd(char *cmdline)
/* dump_qp(qp); */
if (qp && qp->qp_type == QP_CMDEXIT) {
- break;
+ cmd_finished = 1;
+ /* break; */
}
nset--;
}