summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-02-27 16:11:28 -0500
committerJune McEnroe <june@causal.agency>2018-02-27 16:11:28 -0500
commite58ad6ede68c2c73b15216ec6aabefc395593bb7 (patch)
tree34ed14bac798b8b6fb2a8422f3a969df94d00f02
parentRemove jrp (diff)
downloadsrc-e58ad6ede68c2c73b15216ec6aabefc395593bb7.tar.gz
src-e58ad6ede68c2c73b15216ec6aabefc395593bb7.zip
Check revents with &
-rw-r--r--bin/dtch.c4
-rw-r--r--bin/hnel.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/bin/dtch.c b/bin/dtch.c
index bed3537c..b6d0355c 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 97f3cf0d..82f990d4 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);