On Fri, May 04, 2018 at 11:51:09AM +0200, Jesper Wallin wrote:
> On Fri, May 04, 2018 at 09:03:38AM +0200, Alexandre Ratchov wrote:
> > Thanks. The promise list to use audio and/or midi is in the
> > sio_open(2) man page, so the following seem to be needed: stdio,
> > audio, rpath, wpath, cpath, unix, inet, dns.
> > 
> > aucat could be pledged() since the very beginning; imho this makes
> > sense as the "risky" part is slot_new(), when file headers are parsed.
> >
> 
> Ah! You're right, I've only been able to test this again the local
> sndiod(8).  I moved the inital pledge to the top but kept the one for
> offline mode.  I'm not sure if pledge is meant to be used so far down in
> a program, but I drop all pledges except stdio and audio once
> sio_open(2) is finished.

The approach looks correct, maybe someone here could confirm?

> @@ -1461,6 +1467,8 @@ main(int argc, char **argv)
>                       log_puts("both -i and -o required\n");
>                       return 1;
>               }
> +             if (pledge("stdio rpath wpath cpath", NULL) == -1)
> +                     err(1, "pledge");

AFAIU, only "sndio" is needed in offline(), because files are already
opened/created.

As we're at it, could you move the call to offline(), to make
offline() look like playrec(), please?
 
>               if (!offline())
>                       return 1;
>       } else {
> 

Reply via email to