summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2008-11-20 16:31:26 +0000
committerratchov <ratchov@openbsd.org>2008-11-20 16:31:26 +0000
commita2e5dda06efd0798b847d6cfd71144408c7abb5e (patch)
treee45856944fc577cc6dde5bc35bd760e811acb189 /lib
parentKNF; only white space changes (diff)
downloadwireguard-openbsd-a2e5dda06efd0798b847d6cfd71144408c7abb5e.tar.xz
wireguard-openbsd-a2e5dda06efd0798b847d6cfd71144408c7abb5e.zip
make both aucat(1) and audio(4) backends use the AUDIODEVICE env
variable to determine the socket or the device to use. Allow choosing the when aucat(1) is used too. Noticed and tested by naddy@
Diffstat (limited to 'lib')
-rw-r--r--lib/libsndio/sndio.c4
-rw-r--r--lib/libsndio/sun.c9
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/libsndio/sndio.c b/lib/libsndio/sndio.c
index afc9b36013c..cccc38905ee 100644
--- a/lib/libsndio/sndio.c
+++ b/lib/libsndio/sndio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sndio.c,v 1.6 2008/11/11 19:39:35 ratchov Exp $ */
+/* $OpenBSD: sndio.c,v 1.7 2008/11/20 16:31:26 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -164,6 +164,8 @@ sio_open(char *str, unsigned mode, int nbio)
if ((mode & (SIO_PLAY | SIO_REC)) == 0)
return NULL;
+ if (str == NULL)
+ str = getenv("AUDIODEVICE");
hdl = sio_open_aucat(str, mode, nbio);
if (hdl != NULL)
return hdl;
diff --git a/lib/libsndio/sun.c b/lib/libsndio/sun.c
index 079ec9a5391..5b4db13842b 100644
--- a/lib/libsndio/sun.c
+++ b/lib/libsndio/sun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sun.c,v 1.6 2008/11/20 08:32:03 ratchov Exp $ */
+/* $OpenBSD: sun.c,v 1.7 2008/11/20 16:31:26 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -453,11 +453,8 @@ sio_open_sun(char *path, unsigned mode, int nbio)
return NULL;
sio_create(&hdl->sa, &sun_ops, mode, nbio);
- if (path == NULL) {
- path = getenv("AUDIODEVICE");
- if (path == NULL)
- path = SIO_SUN_PATH;
- }
+ if (path == NULL)
+ path = SIO_SUN_PATH;
if (mode == (SIO_PLAY | SIO_REC))
flags = O_RDWR;
else