* process.c (wait_reading_process_output): Revert previous change.
authorChong Yidong <cyd@gnu.org>
Mon, 5 Nov 2012 04:00:58 +0000 (12:00 +0800)
committerChong Yidong <cyd@gnu.org>
Mon, 5 Nov 2012 04:00:58 +0000 (12:00 +0800)
src/ChangeLog
src/process.c

index 6c51527..d0f42dd 100644 (file)
@@ -1,3 +1,7 @@
+2012-11-05  Chong Yidong  <cyd@gnu.org>
+
+       * process.c (wait_reading_process_output): Revert previous change.
+
 2012-11-05  Paul Eggert  <eggert@cs.ucla.edu>
 
        Assume at least POSIX.1-1988 for getpgrp, setpgid, setsid (Bug#12800).
index 16600f9..43f0239 100644 (file)
@@ -4336,6 +4336,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
 
   while (1)
     {
+      int timeout_reduced_for_timers = 0;
+
       /* If calling from keyboard input, do not quit
         since we want to return C-g as an input character.
         Otherwise, do pending quit if requested.  */
@@ -4415,7 +4417,10 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
              if (EMACS_TIME_VALID_P (timer_delay))
                {
                  if (EMACS_TIME_LT (timer_delay, timeout))
-                   timeout = timer_delay;
+                   {
+                     timeout = timer_delay;
+                     timeout_reduced_for_timers = 1;
+                   }
                }
              else
                {
@@ -4674,12 +4679,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
       /*  If we woke up due to SIGWINCH, actually change size now.  */
       do_pending_window_change (0);
 
-      /* We used to break here if nfds == 0, i.e. we seemed to have
-        waited the full period.  But apparently if Emacs receives
-        SIGIO between set_waiting_for_input and select, select can
-        return with nfds == 0 due to the timeout being zeroed out by
-        the signal handler (Bug#11536).  */
-
+      if ((time_limit || nsecs) && nfds == 0 && ! timeout_reduced_for_timers)
+       /* We waited the full specified time, so return now.  */
+       break;
       if (nfds < 0)
        {
          if (xerrno == EINTR)