summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2015-10-02 09:40:57 +0000
committerratchov <ratchov@openbsd.org>2015-10-02 09:40:57 +0000
commit130e1f1b03d900945ac9de93412cc2a3d520044f (patch)
treeadb0180c933e52ae9552ae81a077b3afff3273b1
parentAs the socket path is known, use its size rather that PATH_MAX. (diff)
downloadwireguard-openbsd-130e1f1b03d900945ac9de93412cc2a3d520044f.tar.xz
wireguard-openbsd-130e1f1b03d900945ac9de93412cc2a3d520044f.zip
Use macros for audio and midi device paths rather than hardcoded
strings. No object change.
-rw-r--r--lib/libsndio/mio_rmidi.c5
-rw-r--r--lib/libsndio/sio_sun.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/libsndio/mio_rmidi.c b/lib/libsndio/mio_rmidi.c
index 6f22352d382..ba48cde227c 100644
--- a/lib/libsndio/mio_rmidi.c
+++ b/lib/libsndio/mio_rmidi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mio_rmidi.c,v 1.16 2015/10/02 09:30:04 ratchov Exp $ */
+/* $OpenBSD: mio_rmidi.c,v 1.17 2015/10/02 09:40:57 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -30,6 +30,7 @@
#include "debug.h"
#include "mio_priv.h"
+#define DEVPATH_PREFIX "/dev/rmidi"
struct mio_rmidi_hdl {
struct mio_hdl mio;
int fd;
@@ -71,7 +72,7 @@ _mio_rmidi_open(const char *str, unsigned int mode, int nbio)
return NULL;
_mio_create(&hdl->mio, &mio_rmidi_ops, mode, nbio);
- snprintf(path, sizeof(path), "/dev/rmidi%s", str);
+ snprintf(path, sizeof(path), DEVPATH_PREFIX "%s", str);
if (mode == (MIO_OUT | MIO_IN))
flags = O_RDWR;
else
diff --git a/lib/libsndio/sio_sun.c b/lib/libsndio/sio_sun.c
index dbbd04ef0ce..1b7238afebb 100644
--- a/lib/libsndio/sio_sun.c
+++ b/lib/libsndio/sio_sun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio_sun.c,v 1.16 2015/07/28 20:48:49 ratchov Exp $ */
+/* $OpenBSD: sio_sun.c,v 1.17 2015/10/02 09:40:57 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -32,6 +32,7 @@
#include "debug.h"
#include "sio_priv.h"
+#define DEVPATH_PREFIX "/dev/audio"
struct sio_sun_hdl {
struct sio_hdl sio;
int fd;
@@ -345,7 +346,7 @@ _sio_sun_open(const char *str, unsigned int mode, int nbio)
return NULL;
_sio_create(&hdl->sio, &sio_sun_ops, mode, nbio);
- snprintf(path, sizeof(path), "/dev/audio%s", str);
+ snprintf(path, sizeof(path), DEVPATH_PREFIX "%s", str);
if (mode == (SIO_PLAY | SIO_REC))
flags = O_RDWR;
else