diff options
author | Ricardo Mestre <mestre@cvs.openbsd.org> | 2018-09-17 14:14:40 +0000 |
---|---|---|
committer | Ricardo Mestre <mestre@cvs.openbsd.org> | 2018-09-17 14:14:40 +0000 |
commit | 83b815ef3d3bb67c2f684764039b65ab8c79c302 (patch) | |
tree | 6ebb7591cb656dd281ce1e14c315f8fcb026f492 /usr.bin/audioctl/audioctl.c | |
parent | b8fa2c65c5b53e6be3413c67b27d7dd32834e8aa (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.c | 7 |
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); |