diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/process.c b/src/process.c index 14d7b6df1c3..05934294a04 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -4911,16 +4911,22 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4911 | haven't lowered our timeout due to timers or SIGIO and | 4911 | haven't lowered our timeout due to timers or SIGIO and |
| 4912 | have waited a long amount of time due to repeated | 4912 | have waited a long amount of time due to repeated |
| 4913 | timers. */ | 4913 | timers. */ |
| 4914 | struct timespec huge_timespec | ||
| 4915 | = make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_RESOLUTION); | ||
| 4916 | struct timespec cmp_time = huge_timespec; | ||
| 4914 | if (wait < TIMEOUT) | 4917 | if (wait < TIMEOUT) |
| 4915 | break; | 4918 | break; |
| 4916 | struct timespec cmp_time | 4919 | if (wait == TIMEOUT) |
| 4917 | = (wait == TIMEOUT | 4920 | cmp_time = end_time; |
| 4918 | ? end_time | 4921 | if (!process_skipped && got_some_output > 0 |
| 4919 | : (!process_skipped && got_some_output > 0 | 4922 | && (timeout.tv_sec > 0 || timeout.tv_nsec > 0)) |
| 4920 | && (timeout.tv_sec > 0 || timeout.tv_nsec > 0)) | 4923 | { |
| 4921 | ? got_output_end_time | 4924 | if (!timespec_valid_p (got_output_end_time)) |
| 4922 | : invalid_timespec ()); | 4925 | break; |
| 4923 | if (timespec_valid_p (cmp_time)) | 4926 | if (timespec_cmp (got_output_end_time, cmp_time) < 0) |
| 4927 | cmp_time = got_output_end_time; | ||
| 4928 | } | ||
| 4929 | if (timespec_cmp (cmp_time, huge_timespec) < 0) | ||
| 4924 | { | 4930 | { |
| 4925 | now = current_timespec (); | 4931 | now = current_timespec (); |
| 4926 | if (timespec_cmp (cmp_time, now) <= 0) | 4932 | if (timespec_cmp (cmp_time, now) <= 0) |