summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix von Leitner <felix-libowfat@fefe.de>2019-02-21 12:43:06 +0000
committerFelix von Leitner <felix-libowfat@fefe.de>2019-02-21 12:43:06 +0000
commit600d51d5acc597c345d374475ce664a7e38bf19f (patch)
tree3d170a5a19ace3d18a255870a2141658fb0f647f
parente78d79b2632dc25d1146c7b186434029ae0eabba (diff)
downloadlibowfat-600d51d5acc597c345d374475ce664a7e38bf19f.tar.gz
libowfat-600d51d5acc597c345d374475ce664a7e38bf19f.zip
bsd fix
-rw-r--r--io/iom_wait.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/io/iom_wait.c b/io/iom_wait.c
index 33c956c..eaa6fd8 100644
--- a/io/iom_wait.c
+++ b/io/iom_wait.c
@@ -65,7 +65,8 @@ int iom_wait(iomux_t* c,int64* s,unsigned int* revents,unsigned long timeout) {
#elif defined(HAVE_KQUEUE)
struct kevent kev[SLOTS];
struct timespec ts = { .tv_sec=timeout/1000, .tv_nsec=(timeout%1000)*1000000 };
- int r=kevent(c->ctx, 0, 0, &kev, freeslots, &ts);
+ int r=kevent(c->ctx, 0, 0, kev, freeslots, &ts);
+ int i;
if (r<=0) {
/* we ran into a timeout, so let someone else take over */
if (__sync_val_compare_and_swap(&c->working,1,0)==-2) return -2;
@@ -82,7 +83,7 @@ int iom_wait(iomux_t* c,int64* s,unsigned int* revents,unsigned long timeout) {
(kev[i].filter == EVFILT_WRITE ? IOM_WRITE : 0);
if (i+1==r) {
/* return last event instead of enqueueing it */
- *s=kev.ident;
+ *s=kev[i].ident;
*revents=e;
} else {
c->q[c->h].fd=kev[i].ident;