From a381a5f3a16c078c7759e324e92f029153891384 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Tue, 27 Feb 2018 16:11:28 -0500 Subject: Check revents with & --- bin/dtch.c | 4 ++-- bin/hnel.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/dtch.c b/bin/dtch.c index 6fe85838..8c174f82 100644 --- a/bin/dtch.c +++ b/bin/dtch.c @@ -223,7 +223,7 @@ static int atch(int argc, char *argv[]) { { .fd = pty, .events = POLLIN }, }; while (0 < poll(fds, 2, -1)) { - if (fds[0].revents == POLLIN) { + if (fds[0].revents & POLLIN) { ssize_t readSize = read(STDIN_FILENO, buf, sizeof(buf)); if (readSize < 0) err(EX_IOERR, "read(%d)", STDIN_FILENO); @@ -234,7 +234,7 @@ static int atch(int argc, char *argv[]) { if (writeSize < readSize) errx(EX_IOERR, "short write(%d)", pty); } - if (fds[1].revents == POLLIN) { + if (fds[1].revents & POLLIN) { ssize_t readSize = read(pty, buf, sizeof(buf)); if (readSize < 0) err(EX_IOERR, "read(%d)", pty); diff --git a/bin/hnel.c b/bin/hnel.c index 0b365e51..709ea2fc 100644 --- a/bin/hnel.c +++ b/bin/hnel.c @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) { { .fd = pty, .events = POLLIN }, }; while (0 < poll(fds, 2, -1)) { - if (fds[0].revents == POLLIN) { + if (fds[0].revents & POLLIN) { ssize_t readSize = read(STDIN_FILENO, buf, sizeof(buf)); if (readSize < 0) err(EX_IOERR, "read(%d)", STDIN_FILENO); @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) { if (writeSize < readSize) errx(EX_IOERR, "short write(%d)", pty); } - if (fds[1].revents == POLLIN) { + if (fds[1].revents & POLLIN) { ssize_t readSize = read(pty, buf, sizeof(buf)); if (readSize < 0) err(EX_IOERR, "read(%d)", pty); -- cgit 1.4.1