From: Po Lu Date: Wed, 1 Jun 2022 04:50:16 +0000 (+0800) Subject: Fix pselect usage mistakes X-Git-Tag: emacs-29.0.90~1910^2~295^2~29 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8a2dbf9f86f0c79c0e5c5c528ddcb6a5e3d89c00;p=emacs.git Fix pselect usage mistakes * src/xterm.c (x_next_event_from_any_display): (x_wait_for_cell_change): Fix calls to pselect and tests against return value. --- diff --git a/src/xterm.c b/src/xterm.c index f062e6485d6..2421108a417 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10322,7 +10322,7 @@ x_next_event_from_any_display (XEvent *event) /* We don't have to check the return of pselect, because if an error occurs XPending will call the IO error handler, which then brings us out of this loop. */ - pselect (maxfd, &fds, NULL, NULL, NULL, NULL); + pselect (maxfd + 1, &fds, NULL, NULL, NULL, NULL); } } @@ -14945,12 +14945,12 @@ x_wait_for_cell_change (Lisp_Object cell, struct timespec timeout) timeout = timespec_sub (at, current); #ifndef USE_GTK - rc = pselect (maxfd, &fds, NULL, NULL, &timeout, NULL); + rc = pselect (maxfd + 1, &fds, NULL, NULL, &timeout, NULL); - if (rc > 0) + if (rc >= 0) rfds = fds; #else - pselect (maxfd, &fds, NULL, NULL, &timeout, NULL); + pselect (maxfd + 1, &fds, NULL, NULL, &timeout, NULL); #endif } }