summaryrefslogtreecommitdiffstats
path: root/lib/libsndio/sio.c
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2011-05-09 17:34:14 +0000
committerratchov <ratchov@openbsd.org>2011-05-09 17:34:14 +0000
commit20fb3e8c67df45ca4633b11b5eeeb8cf162b4d80 (patch)
tree2e495ceceb9851e68e3d3c5d02d1e3154c24149c /lib/libsndio/sio.c
parentinitialize 'pstate' field of the wav structure (diff)
downloadwireguard-openbsd-20fb3e8c67df45ca4633b11b5eeeb8cf162b4d80.tar.xz
wireguard-openbsd-20fb3e8c67df45ca4633b11b5eeeb8cf162b4d80.zip
in sio_psleep(), use an array of SIO_MAXNFDS pollfd strucures rather
than a single one. No behaviour change
Diffstat (limited to 'lib/libsndio/sio.c')
-rw-r--r--lib/libsndio/sio.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libsndio/sio.c b/lib/libsndio/sio.c
index af15bdac0a8..1b1376c7d4f 100644
--- a/lib/libsndio/sio.c
+++ b/lib/libsndio/sio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio.c,v 1.5 2011/05/06 10:25:17 ratchov Exp $ */
+/* $OpenBSD: sio.c,v 1.6 2011/05/09 17:34:14 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -216,19 +216,21 @@ sio_getcap(struct sio_hdl *hdl, struct sio_cap *cap)
static int
sio_psleep(struct sio_hdl *hdl, int event)
{
- struct pollfd pfd;
+ struct pollfd pfd[SIO_MAXNFDS];
int revents;
+ nfds_t nfds;
+ nfds = sio_nfds(hdl);
for (;;) {
- sio_pollfd(hdl, &pfd, event);
- while (poll(&pfd, 1, -1) < 0) {
+ sio_pollfd(hdl, pfd, event);
+ while (poll(pfd, nfds, -1) < 0) {
if (errno == EINTR)
continue;
DPERROR("sio_psleep: poll");
hdl->eof = 1;
return 0;
}
- revents = sio_revents(hdl, &pfd);
+ revents = sio_revents(hdl, pfd);
if (revents & POLLHUP) {
DPRINTF("sio_psleep: hang-up\n");
return 0;