summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2020-12-23 13:53:45 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2020-12-23 13:53:45 +0000
commitcdf0bd900ef8ad8f43dc6f6cc521e17e9d5fd3f2 (patch)
tree70fe1b72e2c92f59401e7d48e861d1ebc530a5d9
parentbb9a5ee9647eca55844502341d6656aa0867d5e1 (diff)
Clear error before each iteration in kqueue_scan()
This fixes a regression where kqueue_scan() may incorrectly return EWOULDBLOCK after a timeout. OK mpi@
-rw-r--r--sys/kern/kern_event.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 96688b7d18e..71613f412f8 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.153 2020/12/20 12:54:05 visa Exp $ */
+/* $OpenBSD: kern_event.c,v 1.154 2020/12/23 13:53:44 visa Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -977,6 +977,8 @@ kqueue_scan(struct kqueue_scan_state *scan, int maxevents,
retry:
KASSERT(nkev == 0);
+ error = 0;
+
if (kq->kq_state & KQ_DYING) {
error = EBADF;
goto done;