Commit a5dcc97b authored by Paul Eggert's avatar Paul Eggert
Browse files

Fix open-network-stream responsiveness

Problem reported by Christer Ekholm (Bug#23864).
Backport from master.
* src/process.c (wait_reading_process_output):
Fix typo introduced in 2015-07-06T02:19:13Z!eggert@cs.ucla.edu
when wait == INFINITY and got_output_end_time is invalid.
In this case the code should break, not continue.
parent d4c6774f
...@@ -4911,16 +4911,22 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, ...@@ -4911,16 +4911,22 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
haven't lowered our timeout due to timers or SIGIO and haven't lowered our timeout due to timers or SIGIO and
have waited a long amount of time due to repeated have waited a long amount of time due to repeated
timers. */ timers. */
struct timespec huge_timespec
= make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_RESOLUTION);
struct timespec cmp_time = huge_timespec;
if (wait < TIMEOUT) if (wait < TIMEOUT)
break; break;
struct timespec cmp_time if (wait == TIMEOUT)
= (wait == TIMEOUT cmp_time = end_time;
? end_time if (!process_skipped && got_some_output > 0
: (!process_skipped && got_some_output > 0 && (timeout.tv_sec > 0 || timeout.tv_nsec > 0))
&& (timeout.tv_sec > 0 || timeout.tv_nsec > 0)) {
? got_output_end_time if (!timespec_valid_p (got_output_end_time))
: invalid_timespec ()); break;
if (timespec_valid_p (cmp_time)) if (timespec_cmp (got_output_end_time, cmp_time) < 0)
cmp_time = got_output_end_time;
}
if (timespec_cmp (cmp_time, huge_timespec) < 0)
{ {
now = current_timespec (); now = current_timespec ();
if (timespec_cmp (cmp_time, now) <= 0) if (timespec_cmp (cmp_time, now) <= 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment