From e0bd36a5028dd712c68d3d7f9bfb5de0c93d63b9 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Wed, 14 May 2008 19:56:41 +0200 Subject: [PATCH] Fix a mistake in kqueue 'overflow' handling. If there is no space in the output buffer to report an error adding to the kqueue, kevent(2) will abort and return the error in errno (I was correct that it does not tell you where it failed). So do not abort the loop if kevent(2) fails and do not log (expected) EBADF. --- libratbox/src/kqueue.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libratbox/src/kqueue.c b/libratbox/src/kqueue.c index f047c59..fe56a68 100644 --- a/libratbox/src/kqueue.c +++ b/libratbox/src/kqueue.c @@ -121,12 +121,9 @@ kq_update_events(rb_fde_t * F, short filter, PF * handler) { ret = kevent(kq, kqlst + i, 1, NULL, 0, &zero_timespec); /* jdc -- someone needs to do error checking... */ - if(ret == -1) - { + /* EBADF is normal here -- jilles */ + if(ret == -1 && errno != EBADF) rb_lib_log("kq_update_events(): kevent(): %s", strerror(errno)); - kqoff = 0; - return; - } } kqoff = 0; }