]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix open-network-stream responsiveness
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 Jul 2016 08:49:21 +0000 (10:49 +0200)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 Jul 2016 08:50:31 +0000 (10:50 +0200)
Problem reported by Constantin Kulikov (Bug#23684).
* 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.

src/process.c

index ed0c529cd75fc5374c93da5c6a79e5034bb27597..376e87230dfe50bd2952233dbfcb4f7e2ce76e89 100644 (file)
@@ -5269,16 +5269,20 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
              haven't lowered our timeout due to timers or SIGIO and
              have waited a long amount of time due to repeated
              timers.  */
+         struct timespec cmp_time;
+         bool have_cmp_time = false;
          if (wait < TIMEOUT)
            break;
-         struct timespec cmp_time
-           = (wait == TIMEOUT
-              ? end_time
-              : (!process_skipped && got_some_output > 0
-                 && (timeout.tv_sec > 0 || timeout.tv_nsec > 0))
-              ? got_output_end_time
-              : invalid_timespec ());
-         if (timespec_valid_p (cmp_time))
+         else if (wait == TIMEOUT)
+           cmp_time = end_time, have_cmp_time = true;
+         else if (!process_skipped && got_some_output > 0
+                  && (timeout.tv_sec > 0 || timeout.tv_nsec > 0))
+           {
+             if (!timespec_valid_p (got_output_end_time))
+               break;
+             cmp_time = got_output_end_time, have_cmp_time = true;
+           }
+         if (have_cmp_time)
            {
              now = current_timespec ();
              if (timespec_cmp (cmp_time, now) <= 0)