summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2018-02-22 15:14:46 -0500
committerJune McEnroe <programble@gmail.com>2018-02-22 15:14:46 -0500
commit76d16526bcba1f2165928285cf0439d11f9ca629 (patch)
treee2756b2941f27f0a5e8b9e00f0962c77235dc1c6
parentInclude libutil in chroot.tar (diff)
downloadstream-76d16526bcba1f2165928285cf0439d11f9ca629.tar.gz
stream-76d16526bcba1f2165928285cf0439d11f9ca629.zip
Handle EINTR from kevent
-rw-r--r--view.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/view.c b/view.c
index be69fef..9ae0ec6 100644
--- a/view.c
+++ b/view.c
@@ -17,6 +17,7 @@
 #include <sys/types.h>
 
 #include <err.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <poll.h>
 #include <signal.h>
@@ -101,7 +102,10 @@ int main(int argc, char *argv[]) {
     for (;;) {
         struct kevent event;
         int nevents = kevent(kq, NULL, 0, &event, 1, NULL);
-        if (nevents < 0) err(EX_OSERR, "kevent");
+        if (nevents < 0) {
+            if (errno == EINTR) continue;
+            err(EX_OSERR, "kevent");
+        }
         if (!nevents) continue;
 
         if (event.ident == (uintptr_t)winch.read) {