diff options
| -rw-r--r-- | src/callproc.c | 32 |
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.") | |||
| 497 | int first = 1; | 497 | int first = 1; |
| 498 | int total_read = 0; | 498 | int total_read = 0; |
| 499 | 499 | ||
| 500 | while ((nread = read (fd[0], bufptr, bufsize)) != 0) | 500 | while (1) |
| 501 | { | 501 | { |
| 502 | if (nread < 0) | 502 | /* Repeatedly read until we've filled as much as possible |
| 503 | of the buffer size we have. But don't read | ||
| 504 | less than 1024--save that for the next bufferfull. */ | ||
| 505 | |||
| 506 | nread = 0; | ||
| 507 | while (nread < bufsize - 1024) | ||
| 503 | { | 508 | { |
| 504 | #if defined (__osf__) && defined (__alpha) | 509 | int this_read |
| 505 | continue; /* Work around bug in DEC OSF/1 V3.0. */ | 510 | = read (fd[0], bufptr + nread, bufsize - nread); |
| 506 | #else | 511 | |
| 507 | break; | 512 | if (this_read < 0) |
| 508 | #endif | 513 | goto give_up; |
| 514 | |||
| 515 | if (this_read == 0) | ||
| 516 | goto give_up_1; | ||
| 517 | |||
| 518 | nread += this_read; | ||
| 509 | } | 519 | } |
| 520 | |||
| 521 | give_up_1: | ||
| 522 | |||
| 523 | /* Now NREAD is the total amount of data in the buffer. */ | ||
| 524 | if (nread == 0) | ||
| 525 | break; | ||
| 526 | |||
| 510 | immediate_quit = 0; | 527 | immediate_quit = 0; |
| 511 | total_read += nread; | 528 | total_read += nread; |
| 512 | 529 | ||
| @@ -531,6 +548,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 531 | immediate_quit = 1; | 548 | immediate_quit = 1; |
| 532 | QUIT; | 549 | QUIT; |
| 533 | } | 550 | } |
| 551 | give_up: ; | ||
| 534 | } | 552 | } |
| 535 | 553 | ||
| 536 | /* Wait for it to terminate, unless it already has. */ | 554 | /* Wait for it to terminate, unless it already has. */ |