summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--lib/libsndio/sio.c12
-rw-r--r--lib/libsndio/sio_priv.h4
2 files changed, 10 insertions, 6 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;
diff --git a/lib/libsndio/sio_priv.h b/lib/libsndio/sio_priv.h
index 1d7ed73e7b1..385a3a17b27 100644
--- a/lib/libsndio/sio_priv.h
+++ b/lib/libsndio/sio_priv.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio_priv.h,v 1.2 2011/04/16 10:52:22 ratchov Exp $ */
+/* $OpenBSD: sio_priv.h,v 1.3 2011/05/09 17:34:14 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -20,6 +20,8 @@
#include <sys/param.h>
#include "sndio.h"
+#define SIO_MAXNFDS 4
+
/*
* private ``handle'' structure
*/