summaryrefslogtreecommitdiff
path: root/usr.bin/audioctl/audioctl.c
diff options
context:
space:
mode:
authorRicardo Mestre <mestre@cvs.openbsd.org>2018-09-17 14:14:40 +0000
committerRicardo Mestre <mestre@cvs.openbsd.org>2018-09-17 14:14:40 +0000
commit83b815ef3d3bb67c2f684764039b65ab8c79c302 (patch)
tree6ebb7591cb656dd281ce1e14c315f8fcb026f492 /usr.bin/audioctl/audioctl.c
parentb8fa2c65c5b53e6be3413c67b27d7dd32834e8aa (diff)
unveil(2) "path" (/dev/audioctl0 by default, or changed via args) with rw
access and disable further calls to unveil(2) with unveil(NULL, NULL). OK ratchov@
Diffstat (limited to 'usr.bin/audioctl/audioctl.c')
-rw-r--r--usr.bin/audioctl/audioctl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/audioctl/audioctl.c b/usr.bin/audioctl/audioctl.c
index bbc035a8dbd..706df9a0f2e 100644
--- a/usr.bin/audioctl/audioctl.c
+++ b/usr.bin/audioctl/audioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audioctl.c,v 1.35 2017/05/31 04:18:58 jsg Exp $ */
+/* $OpenBSD: audioctl.c,v 1.36 2018/09/17 14:14:39 mestre Exp $ */
/*
* Copyright (c) 2016 Alexandre Ratchov <alex@caoua.org>
*
@@ -217,6 +217,11 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
+ if (unveil(path, "rw") == -1)
+ err(1, "unveil");
+ if (unveil(NULL, NULL) == -1)
+ err(1, "unveil");
+
fd = open(path, O_RDWR);
if (fd < 0)
err(1, "%s", path);