bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wgetch_events blocks unnecessarily


From: Bernd Jendrissek
Subject: Re: wgetch_events blocks unnecessarily
Date: Tue, 30 May 2006 14:44:34 +0200
User-agent: Mutt/1.4.2.1i

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, May 30, 2006 at 08:41:03AM -0400, Thomas Dickey wrote:
> On Tue, 30 May 2006, Bernd Jendrissek wrote:
> >         for (count = 0; count < 2; count++) {
> >             if ((mode & (1 << count))
> >                 && (fds[count].revents & POLLIN)) {
> >                 result |= (1 << count);
> >             }
> >
> >This is problematic if there is no SP->_mouse_fd but the caller still
> >requested mode with bit 1 set; in this case _nc_timed_wait() will be
> >accessing an uninitialized fds[count].revents.
> 
> ok - will look again.  I had some problem in mind when I was looking
> at this on Saturday, but do not see it in the slice.

You're right - this isn't quite where the problem is.  IIRC the problem
is that the event list gets *populated* depending on whether there is a
SP->_mouse_fd or not, the the for loop above spills into the first user
_nc_event and sets bits in result.  That's exactly what I was seeing; my
serial port had data but result would indicate that my (nonexistent)
mouse was ready.

BTW s/2/MIN_FDS/?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Please fetch my new key 804177F8 from hkp://wwwkeys.eu.pgp.net/

iD8DBQFEfD4twyMv24BBd/gRAubzAJ4554UbzcwWrD7+ni5AXcLMokT5qgCaA381
I+Q0qCO/Kfl7hijRylawkO8=
=gfze
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]