Any thoughts about doing this? Regression tests are all OK, I'm about
to start a ports build with it in (but I don't expect any problems).

For bzip2 the call is right at the start of main().

For xz it's a bit lower - below hardware_init(), which uses sysctls
to find the amount of memory and number of CPUs.

Index: xz/Makefile
===================================================================
RCS file: /cvs/ports/archivers/xz/Makefile,v
retrieving revision 1.25
diff -u -p -r1.25 Makefile
--- xz/Makefile 31 Mar 2015 18:00:23 -0000      1.25
+++ xz/Makefile 5 Oct 2015 09:23:15 -0000
@@ -3,6 +3,7 @@
 COMMENT=       LZMA compression and decompression tools
 
 DISTNAME=      xz-5.2.1
+REVISION=      0
 SHARED_LIBS=   lzma                 2.1      # .7.1
 CATEGORIES=    archivers
 DPB_PROPERTIES=        parallel
Index: xz/patches/patch-src_xz_main_c
===================================================================
RCS file: xz/patches/patch-src_xz_main_c
diff -N xz/patches/patch-src_xz_main_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ xz/patches/patch-src_xz_main_c      5 Oct 2015 09:23:15 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- src/xz/main.c.orig Mon Oct  5 10:07:16 2015
++++ src/xz/main.c      Mon Oct  5 10:17:18 2015
+@@ -163,6 +163,9 @@ main(int argc, char **argv)
+       // on the command line, thus this must be done before args_parse().
+       hardware_init();
+ 
++      if (tame("stdio wpath cpath fattr", NULL) == -1)
++              err(1, "tame");
++
+       // Parse the command line arguments and get an array of filenames.
+       // This doesn't return if something is wrong with the command line
+       // arguments. If there are no arguments, one filename ("-") is still
Index: bzip2/Makefile
===================================================================
RCS file: /cvs/ports/archivers/bzip2/Makefile,v
retrieving revision 1.64
diff -u -p -r1.64 Makefile
--- bzip2/Makefile      24 May 2014 20:51:54 -0000      1.64
+++ bzip2/Makefile      5 Oct 2015 09:23:15 -0000
@@ -4,7 +4,7 @@ COMMENT=        block-sorting file compressor, 
 
 VERSION=       1.0.6
 DISTNAME=      bzip2-${VERSION}
-REVISION=      1
+REVISION=      2
 CATEGORIES=    archivers
 MASTER_SITES=  ${HOMEPAGE}${VERSION}/
 SHARED_LIBS=   bz2     10.4
@@ -13,6 +13,7 @@ HOMEPAGE=     http://www.bzip.org/
 
 # BSD
 PERMIT_PACKAGE_CDROM=  Yes
+
 WANTLIB=       c
 
 BZ2_CFLAGS=    -Wall -Winline -fomit-frame-pointer -fno-strength-reduce
Index: bzip2/patches/patch-bzip2_c
===================================================================
RCS file: bzip2/patches/patch-bzip2_c
diff -N bzip2/patches/patch-bzip2_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ bzip2/patches/patch-bzip2_c 5 Oct 2015 09:23:15 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- bzip2.c.orig       Mon Oct  5 10:03:08 2015
++++ bzip2.c    Mon Oct  5 10:05:18 2015
+@@ -1781,6 +1781,9 @@ IntNative main ( IntNative argc, Char *argv[] )
+    Cell   *aa;
+    Bool   decode;
+ 
++   if (tame("stdio wpath cpath fattr", NULL) == -1)
++      err(1, "tame");
++
+    /*-- Be really really really paranoid :-) --*/
+    if (sizeof(Int32) != 4 || sizeof(UInt32) != 4  ||
+        sizeof(Int16) != 2 || sizeof(UInt16) != 2  ||

Reply via email to