diff --git a/ttynvt.c b/ttynvt.c index eeec5c8..caf0b3b 100644 --- a/ttynvt.c +++ b/ttynvt.c @@ -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)