diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2014-11-08 20:19:54 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2014-11-08 20:19:54 -0800 |
commit | f86269414156e4d91458f2c70a0f022b92caa6ba (patch) | |
tree | 084576986c64b150b9f38760b4fd4732ab80fe41 /src/xgselect.c | |
parent | 0cd3403ff470aa5a45d526f677659bd16a05caed (diff) | |
download | emacs-f86269414156e4d91458f2c70a0f022b92caa6ba.tar.gz |
* 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.
Diffstat (limited to 'src/xgselect.c')
-rw-r--r-- | src/xgselect.c | 4 |
1 files changed, 2 insertions, 2 deletions
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)); |