On Fri, May 04, 2018 at 12:20:02PM +0200, Alexandre Ratchov wrote:
> AFAIU, only "sndio" is needed in offline(), because files are already
> opened/created.

Ah! Yeha, of course.. :-)


Regards,
Jesper Wallin


Index: aucat.c
===================================================================
RCS file: /cvs/src/usr.bin/aucat/aucat.c,v
retrieving revision 1.172
diff -u -p -r1.172 aucat.c
--- aucat.c     7 Nov 2017 11:39:24 -0000       1.172
+++ aucat.c     4 May 2018 10:30:10 -0000
@@ -14,6 +14,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include <err.h>
 #include <errno.h>
 #include <limits.h>
 #include <poll.h>
@@ -1057,6 +1058,9 @@ offline(void)
        int rate, cmax;
        struct slot *s;
 
+       if (pledge("stdio", NULL) == -1)
+               err(1, "pledge");
+
        rate = cmax = 0;
        for (s = slot_list; s != NULL; s = s->next) {
                if (s->afile.rate > rate)
@@ -1160,6 +1164,8 @@ playrec(char *dev, int mode, int bufsz, 
 
        if (!dev_open(dev, mode, bufsz, port))
                return 0;
+       if (pledge("stdio audio", NULL) == -1)
+               err(1, "pledge");
        n = sio_nfds(dev_sh);
        if (dev_mh)
                n += mio_nfds(dev_mh);
@@ -1363,6 +1369,9 @@ main(int argc, char **argv)
        struct aparams par;
        int n_flag, c;
        long long pos;
+
+       if (pledge("stdio rpath wpath cpath inet unix dns audio", NULL) == -1)
+               err(1, "pledge");
 
        vol = 127;
        dup = 0;

Reply via email to