bug-ncurses
[Top][All Lists]
Advanced

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

Re: wgetch_events blocks unnecessarily


From: Thomas Dickey
Subject: Re: wgetch_events blocks unnecessarily
Date: Tue, 30 May 2006 08:41:03 -0400 (EDT)

On Tue, 30 May 2006, Bernd Jendrissek wrote:

-----BEGIN PGP SIGNED MESSAGE-----
            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.


The next problem is in
ncurses-5.5/ncurses/base/lib_getch.c:fifo_push:167
        n = 1;
   } else
#endif
   {                            /* Can block... */
        unsigned char c2 = 0;
        n = read(SP->_ifd, &c2, 1);
        ch = c2;
   }

#ifdef HIDE_EINTR

This branch executes regardless of whether keyboard input is available
or not; perhaps one could set stdin to nonblocking mode, but I added an
if() clause on evl being NULL or mask indicating keyboard readiness.

I'll take a look at this, too.


Sorry for the English-language patch, but I'd rather be paranoid than
sorry!

thanks


--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

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