Promise not creating files.
Add usual Makefile comment.

Could also defer initial pledge after getopt handling to have a single
        if (no_create)
                pledge("stdio rpath wpath cpath")
        else
                pledge("stdio rpath wpath")

Feedback? OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/truncate/Makefile,v
diff -u -p -r1.4 Makefile
--- Makefile    27 Sep 2023 17:16:35 -0000      1.4
+++ Makefile    28 Nov 2023 02:02:08 -0000
@@ -1,6 +1,7 @@
 COMMENT =      truncate or extend the length of files
 DISTNAME =     truncate-5.2.1
 CATEGORIES =   sysutils
+REVISION =     0
 
 HOMEPAGE =     https://www.dragonflybsd.org/
 MAINTAINER =   Brian Callahan <[email protected]>
@@ -8,6 +9,7 @@ MAINTAINER =    Brian Callahan <bcallah@ope
 # BSD
 PERMIT_PACKAGE =       Yes
 
+# uses pledge()
 WANTLIB += c
 
 SITES =                https://mirrors.nycbug.org/pub/distfiles/
Index: patches/patch-truncate_c
===================================================================
RCS file: patches/patch-truncate_c
diff -N patches/patch-truncate_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-truncate_c    28 Nov 2023 02:07:14 -0000
@@ -0,0 +1,16 @@
+Drop "cpath" under -c (no file creation)
+
+Index: truncate.c
+--- truncate.c.orig
++++ truncate.c
+@@ -84,6 +84,10 @@ main(int argc, char **argv)
+       argv += optind;
+       argc -= optind;
+ 
++      if (no_create)
++              if (pledge("stdio rpath wpath", NULL) == -1)
++                      err(1, "pledge");
++
+       /*
+        * Exactly one of do_refer or got_size must be specified.  Since
+        * do_relative implies got_size, do_relative and do_refer are

Reply via email to