summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2009-08-01 08:32:23 +0000
committerratchov <ratchov@openbsd.org>2009-08-01 08:32:23 +0000
commit9d75d49d5c2a324b13876b91e277f4cbd123c5e3 (patch)
tree41ba678686ced1308e0fb80a3a0d58c4278ef45a /lib
parentsubnet-number and netmask could be ip addresses only. (diff)
downloadwireguard-openbsd-9d75d49d5c2a324b13876b91e277f4cbd123c5e3.tar.xz
wireguard-openbsd-9d75d49d5c2a324b13876b91e277f4cbd123c5e3.zip
honor non-blocking flag in mio_open_rmidi(), fixes programs
eating 100% CPU while trying to use blocking i/o. ok jakemsr
Diffstat (limited to 'lib')
-rw-r--r--lib/libsndio/mio_rmidi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libsndio/mio_rmidi.c b/lib/libsndio/mio_rmidi.c
index 25bd3506e51..e1128f9c39a 100644
--- a/lib/libsndio/mio_rmidi.c
+++ b/lib/libsndio/mio_rmidi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mio_rmidi.c,v 1.4 2009/07/26 12:40:45 ratchov Exp $ */
+/* $OpenBSD: mio_rmidi.c,v 1.5 2009/08/01 08:32:23 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -67,8 +67,9 @@ mio_open_rmidi(const char *str, unsigned mode, int nbio)
flags = O_RDWR;
else
flags = (mode & MIO_OUT) ? O_WRONLY : O_RDONLY;
-
- while ((fd = open(path, flags | O_NONBLOCK)) < 0) {
+ if (nbio)
+ flags |= O_NONBLOCK;
+ while ((fd = open(path, flags)) < 0) {
if (errno == EINTR)
continue;
DPERROR(path);