This re-adds pledge() support for xz and xzdec. For multi-threading, you'll need a really -current kernel since the required __tfork() handling was only added last weekend.
Please try to break it. ;-) Index: Makefile =================================================================== RCS file: /cvs/ports/archivers/xz/Makefile,v retrieving revision 1.30 diff -u -p -r1.30 Makefile --- Makefile 18 Oct 2015 19:45:13 -0000 1.30 +++ Makefile 21 Oct 2015 15:30:27 -0000 @@ -3,6 +3,7 @@ COMMENT= LZMA compression and decompression tools DISTNAME= xz-5.2.2 +REVISION= 0 SHARED_LIBS= lzma 2.1 # .7.2 CATEGORIES= archivers DPB_PROPERTIES= parallel Index: patches/patch-config_h_in =================================================================== RCS file: /cvs/ports/archivers/xz/patches/patch-config_h_in,v retrieving revision 1.6 diff -u -p -r1.6 patch-config_h_in --- patches/patch-config_h_in 31 Mar 2015 18:00:23 -0000 1.6 +++ patches/patch-config_h_in 21 Oct 2015 15:30:27 -0000 @@ -1,7 +1,7 @@ $OpenBSD: patch-config_h_in,v 1.6 2015/03/31 18:00:23 naddy Exp $ ---- config.h.in.orig Thu Feb 26 09:55:23 2015 -+++ config.h.in Mon Mar 2 23:25:39 2015 -@@ -352,7 +352,11 @@ +--- config.h.in.orig Tue Sep 29 13:03:40 2015 ++++ config.h.in Sun Oct 18 21:46:08 2015 +@@ -349,7 +349,11 @@ /* Define to 1 if the system supports fast unaligned access to 16-bit and 32-bit integers. */ Index: patches/patch-src_xz_main_c =================================================================== RCS file: patches/patch-src_xz_main_c diff -N patches/patch-src_xz_main_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_xz_main_c 21 Oct 2015 15:30:27 -0000 @@ -0,0 +1,33 @@ +$OpenBSD: patch-src_xz_main_c,v 1.3 2015/10/15 00:17:48 sthen Exp $ +--- src/xz/main.c.orig Thu Feb 26 15:54:33 2015 ++++ src/xz/main.c Sun Oct 18 02:05:53 2015 +@@ -163,12 +163,29 @@ main(int argc, char **argv) + // on the command line, thus this must be done before args_parse(). + hardware_init(); + ++#ifdef __OpenBSD__ ++ if (pledge("stdio rpath wpath cpath fattr proc", NULL) == -1) ++ message_fatal(_("pledge")); ++#endif ++ + // 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 + // returned to indicate stdin. + args_info args; + args_parse(&args, argc, argv); ++ ++#ifdef __OpenBSD__ ++ // No files on the command line and no --files. ++ if ((args.arg_count == 1 && strcmp(args.arg_names[0], "-") == 0) && ++ args.files_name == NULL) { ++ if (pledge("stdio proc", NULL) == -1) ++ message_fatal(_("pledge")); ++ } else if (opt_stdout || opt_mode == MODE_LIST) { ++ if (pledge("stdio rpath proc", NULL) == -1) ++ message_fatal(_("pledge")); ++ } ++#endif + + if (opt_mode != MODE_LIST && opt_robot) + message_fatal(_("Compression and decompression with --robot " Index: patches/patch-src_xzdec_xzdec_c =================================================================== RCS file: patches/patch-src_xzdec_xzdec_c diff -N patches/patch-src_xzdec_xzdec_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_xzdec_xzdec_c 21 Oct 2015 15:30:27 -0000 @@ -0,0 +1,25 @@ +$OpenBSD$ +--- src/xzdec/xzdec.c.orig Thu Feb 26 15:54:33 2015 ++++ src/xzdec/xzdec.c Sun Oct 18 13:27:51 2015 +@@ -292,9 +292,21 @@ main(int argc, char **argv) + + if (optind == argc) { + // No filenames given, decode from stdin. ++#ifdef __OpenBSD__ ++ if (pledge("stdio", NULL) == -1) { ++ my_errorf("pledge"); ++ exit(EXIT_FAILURE); ++ } ++#endif + uncompress(&strm, stdin, "(stdin)"); + } else { + // Loop through the filenames given on the command line. ++#ifdef __OpenBSD__ ++ if (pledge("stdio rpath", NULL) == -1) { ++ my_errorf("pledge"); ++ exit(EXIT_FAILURE); ++ } ++#endif + do { + // "-" indicates stdin. + if (strcmp(argv[optind], "-") == 0) { -- Christian "naddy" Weisgerber na...@mips.inka.de