From 2d993212c5685ddee20abfed8bf0bc0bc7c76bf4 Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Mon, 15 Oct 2018 07:57:26 +0200 Subject: [PATCH] Cosmetics --- ttynvt.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ttynvt.c b/ttynvt.c index 57e9b0b..cc74758 100644 --- a/ttynvt.c +++ b/ttynvt.c @@ -66,12 +66,13 @@ typedef struct { char tmp_buf[TMP_BUF_SIZE]; struct termios tio; - int cmcr; - int epipe; + int cmcr; volatile int smcr; - volatile int error; + volatile int pollin; + volatile int error; + int epipe; tn_ctx_t *tn; } ttynvt_t; @@ -201,9 +202,9 @@ static void *_read_net(void *arg) { if (errno == EINTR) continue; - else - break; + break; } + if (tty->fds[FD_NET].revents & POLLIN) { res = read(tty->fds[FD_NET].fd, tty->net_buf + tty->net_cnt, @@ -213,7 +214,7 @@ static void *_read_net(void *arg) _log(LOG_ERR, "net read error: %s\n", strerror(errno)); break; } - else if (res == 0) + if (res == 0) { _log(LOG_INFO, "Connection closed by remote host\n"); break; @@ -232,6 +233,7 @@ static void *_read_net(void *arg) tty->net_cnt = 0; } } + if (tty->fds[FD_MASTER].revents & POLLIN) { res = read(tty->fds[FD_MASTER].fd, tty->tmp_buf, TMP_BUF_SIZE); @@ -242,6 +244,7 @@ static void *_read_net(void *arg) } telnet_tx(tty->tn, tty->tmp_buf, res); } + if (tty->fds[FD_SLAVE].revents & POLLIN) { tty->pollin = 1; @@ -838,7 +841,6 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg, case TIOCSETD: CHECK_BUF_IN(sizeof(int)); val = *(int *)in_buf; - res = ioctl(tty->fds[FD_SLAVE].fd, TIOCSETD, &val); if (res < 0) fuse_reply_err(req, errno);