summaryrefslogtreecommitdiffstats
path: root/lib/libsndio/sio.c
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2015-11-22 12:01:23 +0000
committerratchov <ratchov@openbsd.org>2015-11-22 12:01:23 +0000
commit163486f8ab4fb5a71f57ff1e5ed78b98ff7b54ff (patch)
tree0dcfed3964362eea1d5319f6cf72bd5d125ee773 /lib/libsndio/sio.c
parentThe "CRITICAL" APM battery level, that is exported/faked by the ACPI (diff)
downloadwireguard-openbsd-163486f8ab4fb5a71f57ff1e5ed78b98ff7b54ff.tar.xz
wireguard-openbsd-163486f8ab4fb5a71f57ff1e5ed78b98ff7b54ff.zip
Don't remove the type component from the device string before passing
it to the *_open() functions. It's more flexible this way. No behaviour change.
Diffstat (limited to 'lib/libsndio/sio.c')
-rw-r--r--lib/libsndio/sio.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/libsndio/sio.c b/lib/libsndio/sio.c
index 576da94ee3e..1e4f965c862 100644
--- a/lib/libsndio/sio.c
+++ b/lib/libsndio/sio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio.c,v 1.19 2015/01/16 16:48:52 deraadt Exp $ */
+/* $OpenBSD: sio.c,v 1.20 2015/11/22 12:01:23 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -44,7 +44,6 @@ sio_open(const char *str, unsigned int mode, int nbio)
{
static char devany[] = SIO_DEVANY;
struct sio_hdl *hdl;
- const char *p;
#ifdef DEBUG
_sndio_debug_init();
@@ -59,18 +58,15 @@ sio_open(const char *str, unsigned int mode, int nbio)
str = devany;
}
if (strcmp(str, devany) == 0) {
- hdl = _sio_aucat_open("/0", mode, nbio);
+ hdl = _sio_aucat_open("snd/0", mode, nbio);
if (hdl != NULL)
return hdl;
- return _sio_sun_open("/0", mode, nbio);
- }
- if ((p = _sndio_parsetype(str, "snd")) != NULL ||
- (p = _sndio_parsetype(str, "aucat")) != NULL)
- return _sio_aucat_open(p, mode, nbio);
- if ((p = _sndio_parsetype(str, "rsnd")) != NULL ||
- (p = _sndio_parsetype(str, "sun")) != NULL) {
- return _sio_sun_open(p, mode, nbio);
+ return _sio_sun_open("rsnd/0", mode, nbio);
}
+ if (_sndio_parsetype(str, "snd"))
+ return _sio_aucat_open(str, mode, nbio);
+ if (_sndio_parsetype(str, "rsnd"))
+ return _sio_sun_open(str, mode, nbio);
DPRINTF("sio_open: %s: unknown device type\n", str);
return NULL;
}