diff options
author | 2009-08-01 08:32:23 +0000 | |
---|---|---|
committer | 2009-08-01 08:32:23 +0000 | |
commit | 9d75d49d5c2a324b13876b91e277f4cbd123c5e3 (patch) | |
tree | 41ba678686ced1308e0fb80a3a0d58c4278ef45a /lib | |
parent | subnet-number and netmask could be ip addresses only. (diff) | |
download | wireguard-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.c | 7 |
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); |