diff options
author | Nate Straz <nstraz@redhat.com> | 2008-04-08 14:42:02 +0000 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2008-09-23 09:37:47 -0400 |
commit | 2a5d1ac68e3c28951b9b7df25aa41dc959f74bf2 (patch) | |
tree | 9e22e989edce03bb1b2d33b6704d807d8de3ffac /qarsh.c | |
parent | 3358797987483f861c46fdccc7f57869dabc26de (diff) | |
download | qarsh-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.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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) { |