summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-05-09 05:35:45 +0000
committerRichard M. Stallman <rms@gnu.org>1995-05-09 05:35:45 +0000
commit01818f11bc3682c207e5fc3138b287ce4549eaa5 (patch)
treeb1e23ec6fa331ab602d9ef9a2ac7c5afe69cf489
parent6d1a2abafa181917a1bee2dc86eadfbac9c3bdfd (diff)
downloademacs-01818f11bc3682c207e5fc3138b287ce4549eaa5.tar.gz
(Fcall_process): Keep reading till buffer is nearly full.
-rw-r--r--src/callproc.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 5b321f1821f..906674658f7 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -497,16 +497,33 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
int first = 1;
int total_read = 0;
- while ((nread = read (fd[0], bufptr, bufsize)) != 0)
+ while (1)
{
- if (nread < 0)
+ /* Repeatedly read until we've filled as much as possible
+ of the buffer size we have. But don't read
+ less than 1024--save that for the next bufferfull. */
+
+ nread = 0;
+ while (nread < bufsize - 1024)
{
-#if defined (__osf__) && defined (__alpha)
- continue; /* Work around bug in DEC OSF/1 V3.0. */
-#else
- break;
-#endif
+ int this_read
+ = read (fd[0], bufptr + nread, bufsize - nread);
+
+ if (this_read < 0)
+ goto give_up;
+
+ if (this_read == 0)
+ goto give_up_1;
+
+ nread += this_read;
}
+
+ give_up_1:
+
+ /* Now NREAD is the total amount of data in the buffer. */
+ if (nread == 0)
+ break;
+
immediate_quit = 0;
total_read += nread;
@@ -531,6 +548,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
immediate_quit = 1;
QUIT;
}
+ give_up: ;
}
/* Wait for it to terminate, unless it already has. */