From 56771a3eedb8c5ef55d67a707be91b1906e5a45b Mon Sep 17 00:00:00 2001 From: William Ahern Date: Sun, 29 Nov 2009 10:20:46 -0500 Subject: [PATCH] Valgrind fix: Clear struct kevent before checking for OSX bug. William's original commit message: Valgrind complains on startup because kq_init passes to kevent only a partially initialized structure. The code doesn't expect kevent to look at .fflags, .udata, or .data, I suppose, because it merely tickles the kernel looking for an error response. But perhaps that's unwarranted chuminess (notwithstanding that it's checking for an OS X bug), and needless noise nonetheless. --- kqueue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kqueue.c b/kqueue.c index ba9a8bc7..ca557bf5 100644 --- a/kqueue.c +++ b/kqueue.c @@ -146,6 +146,7 @@ kq_init(struct event_base *base) kqueueop->pend_changes_size = NEVENT; /* Check for Mac OS X kqueue bug. */ + memset(&kqueueop->changes[0], 0, sizeof kqueueop->changes[0]); kqueueop->changes[0].ident = -1; kqueueop->changes[0].filter = EVFILT_READ; kqueueop->changes[0].flags = EV_ADD;