Fix a race condition in wait_reading_process_output (tiny change).
authorChong Yidong <cyd@gnu.org>
Sat, 3 Nov 2012 15:44:59 +0000 (23:44 +0800)
committerChong Yidong <cyd@gnu.org>
Sat, 3 Nov 2012 15:44:59 +0000 (23:44 +0800)
* src/process.c (wait_reading_process_output): Avoid a race condition
with SIGIO delivery.

Fixes: debbugs:11536

src/ChangeLog
src/process.c

index 1595537..e26dd56 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-03  Jim Paris  <jim@jtan.com>  (tiny change)
+
+       * process.c (wait_reading_process_output): Avoid a race condition
+       with SIGIO delivery (Bug#11536).
+
 2012-11-03  Chong Yidong  <cyd@gnu.org>
 
        * buffer.c (cursor_type): Untabify docstring.
index 77e99ea..dae687c 100644 (file)
@@ -4697,9 +4697,12 @@ 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);
 
+      /* The following optimization fails if SIGIO is received between
+        set_waiting_for_input and select (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)