From 8a2dbf9f86f0c79c0e5c5c528ddcb6a5e3d89c00 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 1 Jun 2022 12:50:16 +0800 Subject: [PATCH] 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. --- src/xterm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 } } -- 2.39.2