unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master e1c6b40e9d: Fix input availability detection during visible-bell
       [not found] ` <20220413070508.A31F7C01684@vcs2.savannah.gnu.org>
@ 2022-04-21 15:26   ` Robert Pluim
  0 siblings, 0 replies; only message in thread
From: Robert Pluim @ 2022-04-21 15:26 UTC (permalink / raw)
  To: emacs-devel; +Cc: Po Lu

>>>>> On Wed, 13 Apr 2022 03:05:08 -0400 (EDT), Po Lu via Mailing list for Emacs changes <emacs-diffs@gnu.org> said:
 
    Po> +      /* Wait for some input to become available on the X
    Po> +	 connection.  */
    Po> +      FD_ZERO (&fds);
    Po> +      FD_SET (fd, &fds);
    Po> +
    Po>        /* Try to wait that long--but we might wake up sooner.  */
    Po> -      pselect (0, NULL, NULL, NULL, &timeout, NULL);
    Po> +      pselect (fd + 1, &fds, NULL, NULL, &timeout, NULL);
    Po> +
    Po> +      /* Some input is available, exit the visible bell.  */
    Po> +      if (FD_ISSET (fd, &fds))
    Po> +	break;

Strictly speaking youʼre only allowed to check if fd is set in fds if
pselect didnʼt fail, so you should be doing something like this (Iʼve
lost track of whether weʼre allowed to use C99's variable definition
rules now).

diff --git a/src/xterm.c b/src/xterm.c
index 69e9302973..be4d35a62d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8884,12 +8884,13 @@ XTflash (struct frame *f)
 	 connection.  */
       FD_ZERO (&fds);
       FD_SET (fd, &fds);
+      int rc;
 
       /* Try to wait that long--but we might wake up sooner.  */
-      pselect (fd + 1, &fds, NULL, NULL, &timeout, NULL);
+      rc = pselect (fd + 1, &fds, NULL, NULL, &timeout, NULL);
 
       /* Some input is available, exit the visible bell.  */
-      if (FD_ISSET (fd, &fds))
+      if (rc > 0 && FD_ISSET (fd, &fds))
 	break;
     }
 


Robert
-- 



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-21 15:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <164983350790.23236.16612688761682418515@vcs2.savannah.gnu.org>
     [not found] ` <20220413070508.A31F7C01684@vcs2.savannah.gnu.org>
2022-04-21 15:26   ` master e1c6b40e9d: Fix input availability detection during visible-bell Robert Pluim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).