From: mestre Date: Mon, 17 Sep 2018 14:14:39 +0000 (+0000) Subject: unveil(2) "path" (/dev/audioctl0 by default, or changed via args) with rw X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f77e3cc333c40d544e7a78e77fa5731bfa60bf3a;p=openbsd 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@ --- 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 * @@ -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);