aboutsummaryrefslogtreecommitdiff
path: root/Utility/libkqueue.c
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@fischer.debian.org>2012-06-18 22:02:57 +0000
committerGravatar Joey Hess <joey@kitenet.net>2012-06-18 18:03:50 -0400
commitb141d9bcc8b5a4647e3c5f106115c8bf5a67f6cd (patch)
tree4b112bd17a338822561bf9c9e81a93493a72e643 /Utility/libkqueue.c
parenta11825a1f153fc7fe9aa469055b3935f254a4e9d (diff)
retry interrupted kevent calls
Many thanks to geekosaur in #haskell for help with this.
Diffstat (limited to 'Utility/libkqueue.c')
-rw-r--r--Utility/libkqueue.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Utility/libkqueue.c b/Utility/libkqueue.c
index cc001045b..5b38cdd33 100644
--- a/Utility/libkqueue.c
+++ b/Utility/libkqueue.c
@@ -12,6 +12,7 @@
#include <unistd.h>
#include <sys/event.h>
#include <sys/time.h>
+#include <errno.h>
/* The specified fds are added to the set of fds being watched for changes.
* Fds passed to prior calls still take effect, so it's most efficient to
@@ -30,7 +31,11 @@ signed int helper(const int kq, const int fdcnt, const int *fdlist,
0, 0);
}
- nev = kevent(kq, chlist, fdcnt, evlist, 1, timeout);
+ while ((nev = kevent(kq, chlist, fdcnt, evlist, 1, timeout))) {
+ if (!(nev == -1 && errno == EINTR)) {
+ break;
+ }
+ }
if (nev == 1)
return evlist[0].ident;