1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

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@
This commit is contained in:
mestre 2018-09-17 14:14:39 +00:00
parent af446eb323
commit f77e3cc333

View File

@ -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);