summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2015-10-02 09:45:27 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2015-10-02 09:45:27 +0000
commit303b0d8055e9ac7bafa9f95e33d93653a5dea1b4 (patch)
tree6d2ec9693e96f8a4d50e3bc07ee0c71692f1d5f6
parente7b55d5e0bf4ac9f65ab037752e40bcf8e44e4dc (diff)
As device path is known, use its size instead of PATH_MAX
-rw-r--r--lib/libsndio/mio_rmidi.c8
-rw-r--r--lib/libsndio/sio_sun.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/libsndio/mio_rmidi.c b/lib/libsndio/mio_rmidi.c
index ba48cde227c..9e8c3cae8bc 100644
--- a/lib/libsndio/mio_rmidi.c
+++ b/lib/libsndio/mio_rmidi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mio_rmidi.c,v 1.17 2015/10/02 09:40:57 ratchov Exp $ */
+/* $OpenBSD: mio_rmidi.c,v 1.18 2015/10/02 09:45:26 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -31,6 +31,10 @@
#include "mio_priv.h"
#define DEVPATH_PREFIX "/dev/rmidi"
+#define DEVPATH_MAX (1 + \
+ sizeof(DEVPATH_PREFIX) - 1 + \
+ sizeof(int) * 3)
+
struct mio_rmidi_hdl {
struct mio_hdl mio;
int fd;
@@ -57,7 +61,7 @@ _mio_rmidi_open(const char *str, unsigned int mode, int nbio)
{
int fd, flags;
struct mio_rmidi_hdl *hdl;
- char path[PATH_MAX];
+ char path[DEVPATH_MAX];
switch (*str) {
case '/':
diff --git a/lib/libsndio/sio_sun.c b/lib/libsndio/sio_sun.c
index 1b7238afebb..f7deb774996 100644
--- a/lib/libsndio/sio_sun.c
+++ b/lib/libsndio/sio_sun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio_sun.c,v 1.17 2015/10/02 09:40:57 ratchov Exp $ */
+/* $OpenBSD: sio_sun.c,v 1.18 2015/10/02 09:45:26 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -33,6 +33,10 @@
#include "sio_priv.h"
#define DEVPATH_PREFIX "/dev/audio"
+#define DEVPATH_MAX (1 + \
+ sizeof(DEVPATH_PREFIX) - 1 + \
+ sizeof(int) * 3)
+
struct sio_sun_hdl {
struct sio_hdl sio;
int fd;
@@ -331,7 +335,7 @@ _sio_sun_open(const char *str, unsigned int mode, int nbio)
struct audio_info aui;
struct sio_sun_hdl *hdl;
struct sio_par par;
- char path[PATH_MAX];
+ char path[DEVPATH_MAX];
switch (*str) {
case '/':