diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2012-05-23 19:25:12 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2012-05-23 19:25:12 +0000 |
commit | 298f5ad9040c0b93ccd39f1e110caab2684070a4 (patch) | |
tree | d25cfab90de9052fd97269b828e99beabbe85cbc /lib/libsndio/mio.c | |
parent | 6512e92d37b1b4f867171e80f8d8574b6f22912a (diff) |
Make the "default" string a valid device name that has the same effect
as NULL has. This will (hopefully) simplify ports where the user
passes the device string.
Diffstat (limited to 'lib/libsndio/mio.c')
-rw-r--r-- | lib/libsndio/mio.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libsndio/mio.c b/lib/libsndio/mio.c index e359adcb615..8dc0823a930 100644 --- a/lib/libsndio/mio.c +++ b/lib/libsndio/mio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mio.c,v 1.14 2012/04/11 06:05:43 ratchov Exp $ */ +/* $OpenBSD: mio.c,v 1.15 2012/05/23 19:25:11 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -34,6 +34,7 @@ struct mio_hdl * mio_open(const char *str, unsigned int mode, int nbio) { + static char portany[] = MIO_PORTANY; struct mio_hdl *hdl; const char *p; @@ -42,9 +43,14 @@ mio_open(const char *str, unsigned int mode, int nbio) #endif if ((mode & (MIO_OUT | MIO_IN)) == 0) return NULL; - if (str == NULL && !issetugid()) + if (str == NULL) /* backward compat */ + str = portany; + if (strcmp(str, portany) == 0 && !issetugid()) { str = getenv("MIDIDEVICE"); - if (str == NULL) { + if (str == NULL) + str = portany; + } + if (strcmp(str, portany) == 0) { hdl = mio_aucat_open("/0", mode, nbio, 1); if (hdl != NULL) return hdl; |