aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/callproc.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/callproc.c b/src/callproc.c
index b308644e7a3..5b321f1821f 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -200,7 +200,9 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
200 int fd[2]; 200 int fd[2];
201 int filefd; 201 int filefd;
202 register int pid; 202 register int pid;
203 char buf[1024]; 203 char buf[16384];
204 char *bufptr = buf;
205 int bufsize = 16384;
204 int count = specpdl_ptr - specpdl; 206 int count = specpdl_ptr - specpdl;
205 register unsigned char **new_argv 207 register unsigned char **new_argv
206 = (unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *)); 208 = (unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *));
@@ -493,8 +495,9 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
493 { 495 {
494 register int nread; 496 register int nread;
495 int first = 1; 497 int first = 1;
498 int total_read = 0;
496 499
497 while ((nread = read (fd[0], buf, sizeof buf)) != 0) 500 while ((nread = read (fd[0], bufptr, bufsize)) != 0)
498 { 501 {
499 if (nread < 0) 502 if (nread < 0)
500 { 503 {
@@ -505,8 +508,19 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
505#endif 508#endif
506 } 509 }
507 immediate_quit = 0; 510 immediate_quit = 0;
511 total_read += nread;
512
508 if (!NILP (buffer)) 513 if (!NILP (buffer))
509 insert (buf, nread); 514 insert (bufptr, nread);
515
516 /* Make the buffer bigger as we continue to read more data,
517 but not past 64k. */
518 if (bufsize < 64 * 1024 && total_read > 32 * bufsize)
519 {
520 bufsize *= 2;
521 bufptr = (char *) alloca (bufsize);
522 }
523
510 if (!NILP (display) && INTERACTIVE) 524 if (!NILP (display) && INTERACTIVE)
511 { 525 {
512 if (first) 526 if (first)