Don't clear readable flag on poll
When the slave becomes readable we set the pollin flag, and cleared it in ttynvt_poll(). So if ttynvt_poll() is called twice, the readable flag was lost. Now we clear it in ttynvt_read() if there actually are no more data to be read.
This commit is contained in:
@@ -597,7 +597,7 @@ ttynvt_read(fuse_req_t req, size_t size, off_t off,
|
||||
{
|
||||
ttynvt_t *tty = (ttynvt_t *) (uintptr_t) info->fh;
|
||||
char buf[TMP_BUF_SIZE];
|
||||
int res;
|
||||
int res, nr;
|
||||
|
||||
DBG2("%s\n", __func__);
|
||||
|
||||
@@ -626,6 +626,16 @@ ttynvt_read(fuse_req_t req, size_t size, off_t off,
|
||||
tty->ptid_read = 0;
|
||||
tty->n_fds = 3; /* Enable polling of Slave */
|
||||
fuse_req_interrupt_func(req, NULL, NULL);
|
||||
if (res < (int)size)
|
||||
{
|
||||
tty->pollin = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
nr = 0;
|
||||
ioctl(tty->fds[FD_SLAVE].fd, FIONREAD, &nr);
|
||||
tty->pollin = nr > 0;
|
||||
}
|
||||
if (res < 0)
|
||||
{
|
||||
DBG2("%s: error: %m\n", __func__);
|
||||
@@ -1057,7 +1067,6 @@ ttynvt_poll(fuse_req_t req, struct fuse_file_info *info,
|
||||
|
||||
if (tty->pollin)
|
||||
{
|
||||
tty->pollin = 0;
|
||||
revents |= POLLIN;
|
||||
}
|
||||
if (tty->error)
|
||||
|
||||
Reference in New Issue
Block a user