On Sep 13 13:03:51, s...@spacehopper.org wrote:
> On 2016/09/12 18:00, Jan Stary wrote:
> > Attached please find a new patch that pledges audio/gsm
> > and a diff to the Makefile that bumps the revision.
> 
> Usually we try to use the same error-printing function as the
> surrounding code, so in this case I think "perror("pledge");" would
> be better.

OK

> We also often defer pledge until after option parsing, when we have
> a better idea of what is actually needed: for toast(/untoast/tcat)
> this would allow a more accurate pledge because we'll then know
> whether or not it needs filesystem access.
> 
> > $OpenBSD$
> > --- src/toast.c.orig        Mon Sep 12 17:41:27 2016
> > +++ src/toast.c     Mon Sep 12 17:41:36 2016
> 
> If you use "cvs add patch-src_toast_c" you can then do "cvs
> diff -uNp" which will show the added file in the diff.

Better diff below.

        Jan


Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/gsm/Makefile,v
retrieving revision 1.45
diff -u -p -u -p -r1.45 Makefile
--- Makefile    13 Sep 2016 11:33:28 -0000      1.45
+++ Makefile    13 Sep 2016 12:34:04 -0000
@@ -3,6 +3,7 @@
 COMMENT=       GSM audio codec library and converter
 
 DISTNAME=      gsm-1.0.15
+REVISION=      0
 WRKDIST=       ${WRKDIR}/gsm-1.0-pl15
 
 SHARED_LIBS=   gsm     1.0
Index: patches/patch-src_toast_c
===================================================================
RCS file: patches/patch-src_toast_c
diff -N patches/patch-src_toast_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_toast_c   13 Sep 2016 12:34:04 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- src/toast.c.orig   Mon Sep 12 17:41:27 2016
++++ src/toast.c        Mon Sep 12 17:41:36 2016
+@@ -756,6 +756,9 @@ int main P2((ac, av), int ac, char **av)
+       extern int      optind;
+       extern char     * optarg;
+ 
++      if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
++              perror("pledge");
++
+       parse_argv0(*av);
+ 
+       while ((opt = getopt(ac, av, "fcdpvhuaslVFC:")) != EOF) switch (opt) {

Reply via email to