]> code.delx.au - gnu-emacs/blobdiff - src/process.c
* src/macfont.m (mac_font_shape): Make sure that total_advance is increasing.
[gnu-emacs] / src / process.c
index ed0c529cd75fc5374c93da5c6a79e5034bb27597..bdbdefabb64513a5e51d84f00c3b66243451db41 100644 (file)
@@ -5269,16 +5269,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
              have waited a long amount of time due to repeated
              timers.  */
+         struct timespec huge_timespec
+           = make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_RESOLUTION);
+         struct timespec cmp_time = huge_timespec;
          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))
+         if (wait == TIMEOUT)
+           cmp_time = end_time;
+         if (!process_skipped && got_some_output > 0
+             && (timeout.tv_sec > 0 || timeout.tv_nsec > 0))
+           {
+             if (!timespec_valid_p (got_output_end_time))
+               break;
+             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 ();
              if (timespec_cmp (cmp_time, now) <= 0)