From: Paul Eggert Date: Mon, 9 Jul 2012 21:12:08 +0000 (-0700) Subject: * process.c (wait_reading_process_output): 'waitchannels' was unset X-Git-Tag: emacs-24.2.90~1199^2~111 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a0bee46f5ab47acd95dee9e022792ff0db3ff336;p=emacs.git * process.c (wait_reading_process_output): 'waitchannels' was unset when read_kbd || !NILP (wait_for_cell); fix this. --- diff --git a/src/ChangeLog b/src/ChangeLog index 2f8dfbdedf3..f0f060268c4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2012-07-09 Paul Eggert + * process.c (wait_reading_process_output): 'waitchannels' was unset + when read_kbd || !NILP (wait_for_cell); fix this. + Add GCC-style 'const' attribute to functions that can use it. * character.h (char_resolve_modifier_mask): * keyboard.h (make_ctrl_char): diff --git a/src/process.c b/src/process.c index 7e9d746a450..b8c3a18b33d 100644 --- a/src/process.c +++ b/src/process.c @@ -4239,7 +4239,7 @@ wait_reading_process_output_1 (void) If NSECS > 0, the timeout consists of NSECS only. If NSECS < 0, gobble data immediately, as if TIME_LIMIT were negative. - READ_KBD is a lisp value: + READ_KBD is: 0 to ignore keyboard input, or 1 to return when input is available, or -1 meaning caller will actually read the input, so don't throw to @@ -6820,7 +6820,7 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, If NSECS > 0, the timeout consists of NSECS only. If NSECS < 0, gobble data immediately, as if TIME_LIMIT were negative. - READ_KBD is a Lisp_Object: + READ_KBD is: 0 to ignore keyboard input, or 1 to return when input is available, or -1 means caller will actually read the input, so don't throw to @@ -6842,8 +6842,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, { register int nfds; EMACS_TIME end_time, timeout; - SELECT_TYPE waitchannels; - int xerrno; if (time_limit < 0) { @@ -6870,6 +6868,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, while (1) { int timeout_reduced_for_timers = 0; + SELECT_TYPE waitchannels; + int xerrno; /* If calling from keyboard input, do not quit since we want to return C-g as an input character. @@ -6944,13 +6944,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, if (read_kbd < 0) set_waiting_for_input (&timeout); - /* Wait till there is something to do. */ - - if (! read_kbd && NILP (wait_for_cell)) - FD_ZERO (&waitchannels); - else - FD_SET (0, &waitchannels); - /* If a frame has been newly mapped and needs updating, reprocess its display stuff. */ if (frame_garbaged && do_display) @@ -6961,13 +6954,16 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, set_waiting_for_input (&timeout); } + /* Wait till there is something to do. */ + FD_ZERO (&waitchannels); if (read_kbd && detect_input_pending ()) + nfds = 0; + else { - nfds = 0; - FD_ZERO (&waitchannels); + if (read_kbd || !NILP (wait_for_cell)) + FD_SET (0, &waitchannels); + nfds = pselect (1, &waitchannels, NULL, NULL, &timeout, NULL); } - else - nfds = pselect (1, &waitchannels, NULL, NULL, &timeout, NULL); xerrno = errno;