=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mixerctl/mixerctl.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- src/usr.bin/mixerctl/mixerctl.c 2015/02/08 23:40:34 1.30 +++ src/usr.bin/mixerctl/mixerctl.c 2018/08/08 19:35:47 1.31 @@ -1,4 +1,4 @@ -/* $OpenBSD: mixerctl.c,v 1.30 2015/02/08 23:40:34 deraadt Exp $ */ +/* $OpenBSD: mixerctl.c,v 1.31 2018/08/08 19:35:47 mestre Exp $ */ /* $NetBSD: mixerctl.c,v 1.11 1998/04/27 16:55:23 augustss Exp $ */ /* @@ -283,10 +283,20 @@ if (argc == 0 && tflag == 0) aflag = 1; - - if ((fd = open(file, O_RDWR)) == -1) + + if (unveil(file, "rw") == -1) + err(1, "unveil"); + + if ((fd = open(file, O_RDWR)) == -1) { + if (unveil(file, "r") == -1) + err(1, "unveil"); + if ((fd = open(file, O_RDONLY)) == -1) err(1, "%s", file); + } + + if (unveil(NULL, NULL) == -1) + err(1, "unveil"); for (ndev = 0; ; ndev++) { dinfo.index = ndev;