diff options
-rw-r--r-- | src/ChangeLog | 4 | ||||
-rw-r--r-- | src/xgselect.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d5814a65edf..2ef9c6ba9aa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2014-11-09 Paul Eggert <eggert@cs.ucla.edu> + * xgselect.c (xg_select): Don't assume n_gfds is nonnegative + merely because tmo_in_millisec is nonnegative. The 1st call + to g_main_context_query could succeed while the 2nd one fails. + * frame.c (Fcan_run_window_configuration_change_hook): Return a value. 2014-11-08 Jan Djärv <jan.h.d@swipnet.se> diff --git a/src/xgselect.c b/src/xgselect.c index 4e2d1c8db69..7e883eb53c6 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -56,7 +56,7 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, int gfds_size = ARRAYELTS (gfds_buf); int n_gfds, retval = 0, our_fds = 0, max_fds = fds_lim - 1; bool context_acquired = false; - int i, nfds, tmo_in_millisec = -1; + int i, nfds, tmo_in_millisec; bool need_to_dispatch; USE_SAFE_ALLOCA; @@ -102,7 +102,7 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, SAFE_FREE (); - if (tmo_in_millisec >= 0) + if (n_gfds >= 0 && tmo_in_millisec >= 0) { tmo = make_timespec (tmo_in_millisec / 1000, 1000 * 1000 * (tmo_in_millisec % 1000)); |