From 7cbb10693eca426327a3aa4c326bb83c9bc7d74d Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 22 Feb 2020 12:22:25 +0000 Subject: [PATCH] linux: Set timeout argument on poll() properly `0` for the timeout means *return immediately* instead of *wait forever*. This is absolutely unnecessary, so change the argument to `-1` which does mean *wait until something happens*. --- linux/esptun.c | 2 +- linux/term.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/esptun.c b/linux/esptun.c index b23c6d9..7327714 100644 --- a/linux/esptun.c +++ b/linux/esptun.c @@ -540,7 +540,7 @@ int main(int argc, char **argv) fds[i].revents = 0; } - if (poll(fds, 2, 0) < 0) { + if (poll(fds, 2, -1) < 0) { perror("poll"); exit(1); } diff --git a/linux/term.c b/linux/term.c index 636f92e..0aa8f82 100644 --- a/linux/term.c +++ b/linux/term.c @@ -92,7 +92,7 @@ int main(int argc, char **argv) { fds[i].revents = 0; } - if (poll(fds, 2, 0) < 0) { + if (poll(fds, 2, -1) < 0) { fprintf(stderr, "Poll error: %s\n", strerror(errno)); exit(1); }