summaryrefslogtreecommitdiffstats
path: root/qarsh.c
diff options
context:
space:
mode:
authorNate Straz <nstraz@redhat.com>2008-04-08 14:42:02 +0000
committerNathan Straz <nstraz@redhat.com>2008-09-23 09:37:47 -0400
commit2a5d1ac68e3c28951b9b7df25aa41dc959f74bf2 (patch)
tree9e22e989edce03bb1b2d33b6704d807d8de3ffac /qarsh.c
parent3358797987483f861c46fdccc7f57869dabc26de (diff)
downloadqarsh-2a5d1ac68e3c28951b9b7df25aa41dc959f74bf2.tar.gz
qarsh-2a5d1ac68e3c28951b9b7df25aa41dc959f74bf2.tar.xz
qarsh-2a5d1ac68e3c28951b9b7df25aa41dc959f74bf2.zip
Increase the buffer size we use to read output from the host. This should
help get all output before we exit. There is still a race if the cmdexit packet returns before all output where we could truncate output.
Diffstat (limited to 'qarsh.c')
-rw-r--r--qarsh.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/qarsh.c b/qarsh.c
index cf80d96..de963fb 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -45,6 +45,7 @@
#include "hbeat.h"
#define QARSH_MINPORT 5010
+#define QARSH_BUFSIZE 4096
/* Globals */
@@ -264,8 +265,8 @@ run_remote_cmd(char *cmdline)
"fcntl stdin O_NONBLOCK failed, %d: %s\n",
errno, strerror(errno));
}
- buf = malloc(1024);
- memset(buf, 0, 1024);
+ buf = malloc(QARSH_BUFSIZE);
+ memset(buf, 0, QARSH_BUFSIZE);
hbeat(qarsh_hb);
cmd_finished = 0;
@@ -278,7 +279,7 @@ run_remote_cmd(char *cmdline)
timeout.tv_nsec = 0;
}
testfds = readfds;
- memset(buf, 0, 1024);
+ memset(buf, 0, QARSH_BUFSIZE);
nset = pselect(FD_SETSIZE, &testfds, NULL, NULL, &timeout,
&pselect_sigmask);
@@ -314,7 +315,7 @@ run_remote_cmd(char *cmdline)
hbeat_setstate(qarsh_hb, HOST_ALIVE);
if (nset && FD_ISSET(fileno(stdin), &testfds)) {
- bufsize = read(fileno(stdin), buf, 1024);
+ bufsize = read(fileno(stdin), buf, QARSH_BUFSIZE);
if (bufsize > 0) {
write(c_in, buf, bufsize);
} else if (bufsize == 0) {
@@ -326,7 +327,7 @@ run_remote_cmd(char *cmdline)
nset--;
}
if (nset && c_out && FD_ISSET(c_out, &testfds)) {
- bufsize = read(c_out, buf, 1024);
+ bufsize = read(c_out, buf, QARSH_BUFSIZE);
if (bufsize > 0) {
write(fileno(stdout), buf, bufsize);
} else if (bufsize == 0) {
@@ -337,7 +338,7 @@ run_remote_cmd(char *cmdline)
nset--;
}
if (nset && c_err && FD_ISSET(c_err, &testfds)) {
- bufsize = read(c_err, buf, 1024);
+ bufsize = read(c_err, buf, QARSH_BUFSIZE);
if (bufsize > 0) {
write(fileno(stderr), buf, bufsize);
} else if (bufsize == 0) {