summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2008-11-09 15:32:50 +0000
committerratchov <ratchov@openbsd.org>2008-11-09 15:32:50 +0000
commit927f485d7d370b200c55cd86e9c43d5342732bae (patch)
treeeb1a9ef9b53d82c6942c88e5a77af93260e15eba /lib
parentRework that way that agp attaches. (diff)
downloadwireguard-openbsd-927f485d7d370b200c55cd86e9c43d5342732bae.tar.xz
wireguard-openbsd-927f485d7d370b200c55cd86e9c43d5342732bae.zip
if the device is not started, make sio_pollfd() pass 0 events bitmap
to the backend to avoid reporing the device as writable when it's stopped. Solves 100% CPU usage of apps poll()ing a stopped device.
Diffstat (limited to 'lib')
-rw-r--r--lib/libsndio/sndio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libsndio/sndio.c b/lib/libsndio/sndio.c
index 22a7e660412..6089320b403 100644
--- a/lib/libsndio/sndio.c
+++ b/lib/libsndio/sndio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sndio.c,v 1.4 2008/11/09 12:22:27 ratchov Exp $ */
+/* $OpenBSD: sndio.c,v 1.5 2008/11/09 15:32:50 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -435,6 +435,8 @@ sio_pollfd(struct sio_hdl *hdl, struct pollfd *pfd, int events)
{
if (hdl->eof)
return 0;
+ if (!hdl->started)
+ events = 0;
return hdl->ops->pollfd(hdl, pfd, events);
}