summaryrefslogtreecommitdiff
path: root/pkg/openbsd/patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/openbsd/patch')
-rw-r--r--pkg/openbsd/patch/0001-fts-Avoid-d_namlen.patch50
-rw-r--r--pkg/openbsd/patch/0002-fts-Add-some-includes.patch46
-rw-r--r--pkg/openbsd/patch/0003-pax-Set-listf-to-stderr-in-main.patch34
-rw-r--r--pkg/openbsd/patch/0004-pax-Add-some-includes.patch63
-rw-r--r--pkg/openbsd/patch/0005-tar-Default-to-stdin.patch27
-rw-r--r--pkg/openbsd/patch/0006-yacc-Add-some-includes.patch24
-rw-r--r--pkg/openbsd/patch/0007-diff-Add-missing-includes.patch37
-rw-r--r--pkg/openbsd/patch/0008-patch-Add-missing-includes.patch37
-rw-r--r--pkg/openbsd/patch/0009-patch-Avoid-d_namlen.patch25
-rw-r--r--pkg/openbsd/patch/0010-patch-Fix-with-musl-s-basename-dirname.patch46
-rw-r--r--pkg/openbsd/patch/0011-pax-Fix-GNU-long-name-handling-with-short-read.patch176
-rw-r--r--pkg/openbsd/patch/0012-pax-Support-xz-compression-with-J-flag.patch90
-rw-r--r--pkg/openbsd/patch/0013-setprogname-Explicitly-discard-const-qualifier.patch26
13 files changed, 681 insertions, 0 deletions
diff --git a/pkg/openbsd/patch/0001-fts-Avoid-d_namlen.patch b/pkg/openbsd/patch/0001-fts-Avoid-d_namlen.patch
new file mode 100644
index 00000000..fb3e7cbd
--- /dev/null
+++ b/pkg/openbsd/patch/0001-fts-Avoid-d_namlen.patch
@@ -0,0 +1,50 @@
+From 03bc025e5ccfc5ba5524cd76a83a5682263fd3e4 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sun, 17 Apr 2016 23:50:15 -0700
+Subject: [PATCH] fts: Avoid d_namlen
+
+---
+ lib/libc/gen/fts.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
+index 9a9b2a5..77e1e77 100644
+--- a/lib/libc/gen/fts.c
++++ b/lib/libc/gen/fts.c
+@@ -556,6 +556,7 @@ fts_build(FTS *sp, int type)
+ int nitems, cderrno, descend, level, nlinks, nostat, doadjust;
+ int saved_errno;
+ char *cp;
++ size_t namlen;
+
+ /* Set current node pointer. */
+ cur = sp->fts_cur;
+@@ -654,11 +655,13 @@ fts_build(FTS *sp, int type)
+ if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
+ continue;
+
+- if (!(p = fts_alloc(sp, dp->d_name, (size_t)dp->d_namlen)))
++ namlen = strlen(dp->d_name);
++
++ if (!(p = fts_alloc(sp, dp->d_name, namlen)))
+ goto mem1;
+- if (dp->d_namlen >= maxlen) { /* include space for NUL */
++ if (namlen >= maxlen) { /* include space for NUL */
+ oldaddr = sp->fts_path;
+- if (fts_palloc(sp, dp->d_namlen +len + 1)) {
++ if (fts_palloc(sp, namlen +len + 1)) {
+ /*
+ * No more memory for path or structures. Save
+ * errno, free up the current structure and the
+@@ -684,7 +687,7 @@ mem1: saved_errno = errno;
+
+ p->fts_level = level;
+ p->fts_parent = sp->fts_cur;
+- p->fts_pathlen = len + dp->d_namlen;
++ p->fts_pathlen = len + namlen;
+ if (p->fts_pathlen < len) {
+ /*
+ * If we wrap, free up the current structure and
+--
+2.9.3
+
diff --git a/pkg/openbsd/patch/0002-fts-Add-some-includes.patch b/pkg/openbsd/patch/0002-fts-Add-some-includes.patch
new file mode 100644
index 00000000..a6a16303
--- /dev/null
+++ b/pkg/openbsd/patch/0002-fts-Add-some-includes.patch
@@ -0,0 +1,46 @@
+From de6a55b9392c80bb9be3dd8b9bb816d8d269ee5b Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 18 Apr 2016 01:25:29 -0700
+Subject: [PATCH] fts: Add some includes
+
+---
+ include/fts.h | 2 ++
+ lib/libc/gen/fts.c | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/include/fts.h b/include/fts.h
+index eaf6be0..a5b3aff 100644
+--- a/include/fts.h
++++ b/include/fts.h
+@@ -35,6 +35,8 @@
+ #ifndef _FTS_H_
+ #define _FTS_H_
+
++#include <sys/cdefs.h>
++
+ typedef struct {
+ struct _ftsent *fts_cur; /* current node */
+ struct _ftsent *fts_child; /* linked list of children */
+diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
+index 77e1e77..eff297c 100644
+--- a/lib/libc/gen/fts.c
++++ b/lib/libc/gen/fts.c
+@@ -31,6 +31,7 @@
+
+ #include <sys/param.h> /* ALIGN */
+ #include <sys/stat.h>
++#include <sys/types.h>
+
+ #include <dirent.h>
+ #include <errno.h>
+@@ -39,6 +40,7 @@
+ #include <limits.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <time.h>
+ #include <unistd.h>
+
+ #define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+--
+2.9.3
+
diff --git a/pkg/openbsd/patch/0003-pax-Set-listf-to-stderr-in-main.patch b/pkg/openbsd/patch/0003-pax-Set-listf-to-stderr-in-main.patch
new file mode 100644
index 00000000..0ca88edf
--- /dev/null
+++ b/pkg/openbsd/patch/0003-pax-Set-listf-to-stderr-in-main.patch
@@ -0,0 +1,34 @@
+From 2d5f85f2a77ee62751c4ec4193cc55207875a757 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 18 Apr 2016 00:13:51 -0700
+Subject: [PATCH] pax: Set listf to stderr in main
+
+---
+ bin/pax/pax.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/bin/pax/pax.c b/bin/pax/pax.c
+index 1b17b8c..7e62c51 100644
+--- a/bin/pax/pax.c
++++ b/bin/pax/pax.c
+@@ -91,7 +91,7 @@ int docrc; /* check/create file crc */
+ char *dirptr; /* destination dir in a copy */
+ char *argv0; /* root of argv[0] */
+ sigset_t s_mask; /* signal mask for cleanup critical sect */
+-FILE *listf = stderr; /* file pointer to print file list to */
++FILE *listf; /* file pointer to print file list to */
+ int listfd = STDERR_FILENO; /* fd matching listf, for sighandler output */
+ char *tempfile; /* tempfile to use for mkstemp(3) */
+ char *tempbase; /* basename of tempfile to use for mkstemp(3) */
+@@ -222,6 +222,8 @@ main(int argc, char **argv)
+ char *tmpdir;
+ size_t tdlen;
+
++ listf = stderr;
++
+ /*
+ * Keep a reference to cwd, so we can always come back home.
+ */
+--
+2.9.3
+
diff --git a/pkg/openbsd/patch/0004-pax-Add-some-includes.patch b/pkg/openbsd/patch/0004-pax-Add-some-includes.patch
new file mode 100644
index 00000000..4061d470
--- /dev/null
+++ b/pkg/openbsd/patch/0004-pax-Add-some-includes.patch
@@ -0,0 +1,63 @@
+From 140c41d57f7bef789f4a0ea0db0426c1b3f0f38f Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 18 Apr 2016 01:27:29 -0700
+Subject: [PATCH] pax: Add some includes
+
+---
+ bin/pax/ar_subs.c | 1 +
+ bin/pax/file_subs.c | 1 +
+ bin/pax/gen_subs.c | 1 +
+ bin/pax/sel_subs.c | 1 +
+ 4 files changed, 4 insertions(+)
+
+diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c
+index b95b1c2..91b8436 100644
+--- a/bin/pax/ar_subs.c
++++ b/bin/pax/ar_subs.c
+@@ -44,6 +44,7 @@
+ #include <errno.h>
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <time.h>
+ #include "pax.h"
+ #include "extern.h"
+
+diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c
+index 1f27d28..b7239c8 100644
+--- a/bin/pax/file_subs.c
++++ b/bin/pax/file_subs.c
+@@ -36,6 +36,7 @@
+
+ #include <sys/time.h>
+ #include <sys/stat.h>
++#include <sys/types.h>
+ #include <err.h>
+ #include <errno.h>
+ #include <fcntl.h>
+diff --git a/bin/pax/gen_subs.c b/bin/pax/gen_subs.c
+index cd857dc..ae5843e 100644
+--- a/bin/pax/gen_subs.c
++++ b/bin/pax/gen_subs.c
+@@ -43,6 +43,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <vis.h>
++#include <time.h>
+ #include "pax.h"
+ #include "extern.h"
+
+diff --git a/bin/pax/sel_subs.c b/bin/pax/sel_subs.c
+index fc9194d..7bdbe46 100644
+--- a/bin/pax/sel_subs.c
++++ b/bin/pax/sel_subs.c
+@@ -44,6 +44,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <time.h>
+ #include "pax.h"
+ #include "sel_subs.h"
+ #include "extern.h"
+--
+2.8.1
+
diff --git a/pkg/openbsd/patch/0005-tar-Default-to-stdin.patch b/pkg/openbsd/patch/0005-tar-Default-to-stdin.patch
new file mode 100644
index 00000000..f4c2e08c
--- /dev/null
+++ b/pkg/openbsd/patch/0005-tar-Default-to-stdin.patch
@@ -0,0 +1,27 @@
+From 4e6eb43b544fff46d7ca4307b4c0e7699a261ed7 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 18 Apr 2016 01:16:12 -0700
+Subject: [PATCH] tar: Default to stdin
+
+---
+ bin/pax/options.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/bin/pax/options.c b/bin/pax/options.c
+index 8721eaa..51101c7 100644
+--- a/bin/pax/options.c
++++ b/bin/pax/options.c
+@@ -871,9 +871,7 @@ tar_options(int argc, char **argv)
+
+ if (!fstdin && ((arcname == NULL) || (*arcname == '\0'))) {
+ arcname = getenv("TAPE");
+- if ((arcname == NULL) || (*arcname == '\0'))
+- arcname = _PATH_DEFTAPE;
+- else if ((arcname[0] == '-') && (arcname[1]== '\0')) {
++ if ((arcname == NULL) || (*arcname == '\0') || (arcname[0] == '-') && (arcname[1]== '\0')) {
+ arcname = NULL;
+ fstdin = 1;
+ }
+--
+2.9.3
+
diff --git a/pkg/openbsd/patch/0006-yacc-Add-some-includes.patch b/pkg/openbsd/patch/0006-yacc-Add-some-includes.patch
new file mode 100644
index 00000000..a4b0ed78
--- /dev/null
+++ b/pkg/openbsd/patch/0006-yacc-Add-some-includes.patch
@@ -0,0 +1,24 @@
+From 148c9835e6304a4247c7116156e8c5a97f153c0e Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 18 Apr 2016 17:34:01 -0700
+Subject: [PATCH] yacc: Add some includes
+
+---
+ usr.bin/yacc/defs.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h
+index 7300cae..fab6e12 100644
+--- a/usr.bin/yacc/defs.h
++++ b/usr.bin/yacc/defs.h
+@@ -35,6 +35,7 @@
+ * @(#)defs.h 5.6 (Berkeley) 5/24/93
+ */
+
++#include <sys/cdefs.h>
+ #include <assert.h>
+ #include <ctype.h>
+ #include <stdio.h>
+--
+2.8.1
+
diff --git a/pkg/openbsd/patch/0007-diff-Add-missing-includes.patch b/pkg/openbsd/patch/0007-diff-Add-missing-includes.patch
new file mode 100644
index 00000000..2560b726
--- /dev/null
+++ b/pkg/openbsd/patch/0007-diff-Add-missing-includes.patch
@@ -0,0 +1,37 @@
+From cd4851a8e922a6bda085b6d345df2a291004ffb8 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sat, 4 Jun 2016 14:48:20 -0700
+Subject: [PATCH] diff: Add missing includes
+
+---
+ usr.bin/diff/diff.c | 1 +
+ usr.bin/diff/diffreg.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
+index 2b075f12c49..80c7f842ef6 100644
+--- a/usr.bin/diff/diff.c
++++ b/usr.bin/diff/diff.c
+@@ -20,6 +20,7 @@
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
+ */
+
++#include <sys/cdefs.h>
+ #include <sys/stat.h>
+
+ #include <ctype.h>
+diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
+index 35d61c349cb..953018cf553 100644
+--- a/usr.bin/diff/diffreg.c
++++ b/usr.bin/diff/diffreg.c
+@@ -77,6 +77,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <time.h>
+ #include <unistd.h>
+ #include <limits.h>
+
+--
+2.11.0
+
diff --git a/pkg/openbsd/patch/0008-patch-Add-missing-includes.patch b/pkg/openbsd/patch/0008-patch-Add-missing-includes.patch
new file mode 100644
index 00000000..782880c4
--- /dev/null
+++ b/pkg/openbsd/patch/0008-patch-Add-missing-includes.patch
@@ -0,0 +1,37 @@
+From e47145b05bd63b51df6219855747a8247c0910fc Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sat, 4 Jun 2016 18:40:24 -0700
+Subject: [PATCH] patch: Add missing includes
+
+---
+ usr.bin/patch/inp.c | 1 +
+ usr.bin/patch/patch.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c
+index 3f60861..80c4801 100644
+--- a/usr.bin/patch/inp.c
++++ b/usr.bin/patch/inp.c
+@@ -32,6 +32,7 @@
+ #include <sys/mman.h>
+
+ #include <ctype.h>
++#include <fcntl.h>
+ #include <libgen.h>
+ #include <stddef.h>
+ #include <stdint.h>
+diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
+index 8f8f8cd..8087a21 100644
+--- a/usr.bin/patch/patch.c
++++ b/usr.bin/patch/patch.c
+@@ -26,6 +26,7 @@
+ * behaviour
+ */
+
++#include <sys/cdefs.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+--
+2.9.3
+
diff --git a/pkg/openbsd/patch/0009-patch-Avoid-d_namlen.patch b/pkg/openbsd/patch/0009-patch-Avoid-d_namlen.patch
new file mode 100644
index 00000000..0eb9f9d2
--- /dev/null
+++ b/pkg/openbsd/patch/0009-patch-Avoid-d_namlen.patch
@@ -0,0 +1,25 @@
+From 0d285d78276b91b101391a4dab53b0585d2812f8 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sat, 4 Jun 2016 18:40:37 -0700
+Subject: [PATCH] patch: Avoid d_namlen
+
+---
+ usr.bin/patch/backupfile.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/usr.bin/patch/backupfile.c b/usr.bin/patch/backupfile.c
+index d9e40bc..1d7858a 100644
+--- a/usr.bin/patch/backupfile.c
++++ b/usr.bin/patch/backupfile.c
+@@ -95,7 +95,7 @@ max_backup_version(const char *file, const char *dir)
+ file_name_length = strlen(file);
+
+ while ((dp = readdir(dirp)) != NULL) {
+- if (dp->d_namlen <= file_name_length)
++ if (strlen(dp->d_name) <= file_name_length)
+ continue;
+
+ this_version = version_number(file, dp->d_name, file_name_length);
+--
+2.8.1
+
diff --git a/pkg/openbsd/patch/0010-patch-Fix-with-musl-s-basename-dirname.patch b/pkg/openbsd/patch/0010-patch-Fix-with-musl-s-basename-dirname.patch
new file mode 100644
index 00000000..3956747e
--- /dev/null
+++ b/pkg/openbsd/patch/0010-patch-Fix-with-musl-s-basename-dirname.patch
@@ -0,0 +1,46 @@
+From 4eaf0cae80ad349f877a6c29d71d7dcdfa077481 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sat, 4 Jun 2016 20:13:35 -0700
+Subject: [PATCH] patch: Fix with musl's basename/dirname
+
+---
+ usr.bin/patch/backupfile.c | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/usr.bin/patch/backupfile.c b/usr.bin/patch/backupfile.c
+index 1d7858a..243d00e 100644
+--- a/usr.bin/patch/backupfile.c
++++ b/usr.bin/patch/backupfile.c
+@@ -53,21 +53,22 @@ static void invalid_arg(const char *, const char *, int);
+ char *
+ find_backup_file_name(const char *file)
+ {
+- char *dir, *base_versions;
++ char *path, *base_versions;
+ int highest_backup;
+
+ if (backup_type == simple)
+ return concat(file, simple_backup_suffix);
+- base_versions = concat(basename(file), ".~");
+- if (base_versions == NULL)
++ path = strdup(file);
++ if (path == NULL)
+ return NULL;
+- dir = dirname(file);
+- if (dir == NULL) {
+- free(base_versions);
++ base_versions = concat(basename(path), ".~");
++ if (base_versions == NULL) {
++ free(path);
+ return NULL;
+ }
+- highest_backup = max_backup_version(base_versions, dir);
++ highest_backup = max_backup_version(base_versions, dirname(path));
+ free(base_versions);
++ free(path);
+ if (backup_type == numbered_existing && highest_backup == 0)
+ return concat(file, simple_backup_suffix);
+ return make_version_name(file, highest_backup + 1);
+--
+2.8.1
+
diff --git a/pkg/openbsd/patch/0011-pax-Fix-GNU-long-name-handling-with-short-read.patch b/pkg/openbsd/patch/0011-pax-Fix-GNU-long-name-handling-with-short-read.patch
new file mode 100644
index 00000000..6fa04409
--- /dev/null
+++ b/pkg/openbsd/patch/0011-pax-Fix-GNU-long-name-handling-with-short-read.patch
@@ -0,0 +1,176 @@
+From 633eb1c50eb77216f4049c1ec983c5616fef13da Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sat, 3 Dec 2016 20:49:24 -0800
+Subject: [PATCH] pax: Fix GNU long name handling with short read
+
+---
+ bin/pax/ar_subs.c | 66 +++++++++++++++++++++++++++++++++++++++--------------
+ bin/pax/buf_subs.c | 4 +---
+ bin/pax/file_subs.c | 25 +-------------------
+ 3 files changed, 51 insertions(+), 44 deletions(-)
+
+diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c
+index 91b843645af..4071b71e2e0 100644
+--- a/bin/pax/ar_subs.c
++++ b/bin/pax/ar_subs.c
+@@ -37,6 +37,7 @@
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
++#include <err.h>
+ #include <signal.h>
+ #include <string.h>
+ #include <stdio.h>
+@@ -51,6 +52,7 @@
+ static void wr_archive(ARCHD *, int is_app);
+ static int get_arc(void);
+ static int next_head(ARCHD *);
++static int rd_gnu_string(ARCHD *);
+ extern sigset_t s_mask;
+
+ /*
+@@ -96,16 +98,8 @@ list(void)
+ * step through the archive until the format says it is done
+ */
+ while (next_head(arcn) == 0) {
+- if (arcn->type == PAX_GLL || arcn->type == PAX_GLF) {
+- /*
+- * we need to read, to get the real filename
+- */
+- off_t cnt;
+- if (!rd_wrfile(arcn, arcn->type == PAX_GLF
+- ? -1 : -2, &cnt))
+- (void)rd_skip(cnt + arcn->pad);
++ if (rd_gnu_string(arcn))
+ continue;
+- }
+
+ /*
+ * check for pattern, and user specified options match.
+@@ -211,15 +205,8 @@ extract(void)
+ * says it is done
+ */
+ while (next_head(arcn) == 0) {
+- if (arcn->type == PAX_GLL || arcn->type == PAX_GLF) {
+- /*
+- * we need to read, to get the real filename
+- */
+- if (!rd_wrfile(arcn, arcn->type == PAX_GLF
+- ? -1 : -2, &cnt))
+- (void)rd_skip(cnt + arcn->pad);
++ if (rd_gnu_string(arcn))
+ continue;
+- }
+
+ /*
+ * check for pattern, and user specified options match. When
+@@ -1246,3 +1233,48 @@ get_arc(void)
+ paxwarn(1, "Sorry, unable to determine archive format.");
+ return(-1);
+ }
++
++/*
++ * rd_gnu_string()
++ * Read the file contents into an allocated string if it is a GNU tar
++ * long link/file.
++ * Return:
++ * 1 if gnu string read, 0 otherwise
++ */
++
++static int
++rd_gnu_string(ARCHD *arcn)
++{
++ char **strp;
++
++ switch (arcn->type) {
++ case PAX_GLF:
++ strp = &gnu_name_string;
++ break;
++ case PAX_GLL:
++ strp = &gnu_link_string;
++ break;
++ default:
++ strp = NULL;
++ break;
++ }
++ if (!strp)
++ return 0;
++ /*
++ * we need to read, to get the real filename
++ */
++ if (*strp)
++ err(1, "WARNING! Major Internal Error! GNU hack Failing!");
++ *strp = malloc(arcn->sb.st_size + 1);
++ if (*strp == NULL) {
++ paxwarn(1, "Out of memory");
++ (void)rd_skip(arcn->skip + arcn->pad);
++ } else if (rd_wrbuf(*strp, arcn->sb.st_size) < arcn->sb.st_size) {
++ free(*strp);
++ *strp = NULL;
++ } else {
++ (*strp)[arcn->sb.st_size] = '\0';
++ (void)rd_skip(arcn->pad);
++ }
++ return 1;
++}
+diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c
+index cac45294436..31a05c300a6 100644
+--- a/bin/pax/buf_subs.c
++++ b/bin/pax/buf_subs.c
+@@ -673,9 +673,7 @@ rd_wrfile(ARCHD *arcn, int ofd, off_t *left)
+ * pass the blocksize of the file being written to the write routine,
+ * if the size is zero, use the default MINFBSZ
+ */
+- if (ofd < 0)
+- sz = PAXPATHLEN + 1; /* GNU tar long link/file */
+- else if (fstat(ofd, &sb) == 0) {
++ if (fstat(ofd, &sb) == 0) {
+ if (sb.st_blksize > 0)
+ sz = (int)sb.st_blksize;
+ } else
+diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c
+index b7239c87409..5b7f81b713b 100644
+--- a/bin/pax/file_subs.c
++++ b/bin/pax/file_subs.c
+@@ -920,7 +920,6 @@ file_write(int fd, char *str, int cnt, int *rem, int *isempt, int sz,
+ char *end;
+ int wcnt;
+ char *st = str;
+- char **strp;
+
+ /*
+ * while we have data to process
+@@ -979,29 +978,7 @@ file_write(int fd, char *str, int cnt, int *rem, int *isempt, int sz,
+ /*
+ * have non-zero data in this file system block, have to write
+ */
+- switch (fd) {
+- case -1:
+- strp = &gnu_name_string;
+- break;
+- case -2:
+- strp = &gnu_link_string;
+- break;
+- default:
+- strp = NULL;
+- break;
+- }
+- if (strp) {
+- if (*strp)
+- err(1, "WARNING! Major Internal Error! GNU hack Failing!");
+- *strp = malloc(wcnt + 1);
+- if (*strp == NULL) {
+- paxwarn(1, "Out of memory");
+- return(-1);
+- }
+- memcpy(*strp, st, wcnt);
+- (*strp)[wcnt] = '\0';
+- break;
+- } else if (write(fd, st, wcnt) != wcnt) {
++ if (write(fd, st, wcnt) != wcnt) {
+ syswarn(1, errno, "Failed write to file %s", name);
+ return(-1);
+ }
+--
+2.11.0
+
diff --git a/pkg/openbsd/patch/0012-pax-Support-xz-compression-with-J-flag.patch b/pkg/openbsd/patch/0012-pax-Support-xz-compression-with-J-flag.patch
new file mode 100644
index 00000000..61a4332e
--- /dev/null
+++ b/pkg/openbsd/patch/0012-pax-Support-xz-compression-with-J-flag.patch
@@ -0,0 +1,90 @@
+From 5b372180bd0994a256be1a334c565d882f0db458 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sat, 3 Dec 2016 23:50:27 -0800
+Subject: [PATCH] pax: Support xz compression with -J flag
+
+---
+ bin/pax/options.c | 25 ++++++++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+diff --git a/bin/pax/options.c b/bin/pax/options.c
+index 51101c7ad5a..a79a03b5bed 100644
+--- a/bin/pax/options.c
++++ b/bin/pax/options.c
+@@ -78,6 +78,7 @@ static int xz_id(char *_blk, int _size);
+ #define GZIP_CMD "gzip" /* command to run as gzip */
+ #define COMPRESS_CMD "compress" /* command to run as compress */
+ #define BZIP2_CMD "bzip2" /* command to run as bzip2 */
++#define XZ_CMD "xz" /* command to run as xz */
+
+ /*
+ * Format specific routine table
+@@ -221,7 +222,7 @@ pax_options(int argc, char **argv)
+ /*
+ * process option flags
+ */
+- while ((c=getopt(argc,argv,"ab:cdf:ijklno:p:rs:tuvwx:zB:DE:G:HLOPT:U:XYZ0"))
++ while ((c=getopt(argc,argv,"ab:cdf:ijklno:p:rs:tuvwx:zB:DE:G:HJLOPT:U:XYZ0"))
+ != -1) {
+ switch (c) {
+ case 'a':
+@@ -481,6 +482,12 @@ pax_options(int argc, char **argv)
+ Hflag = 1;
+ flg |= CHF;
+ break;
++ case 'J':
++ /*
++ * use xz. Non standard option.
++ */
++ gzip_program = XZ_CMD;
++ break;
+ case 'L':
+ /*
+ * follow symlinks
+@@ -657,7 +664,7 @@ tar_options(int argc, char **argv)
+ * process option flags
+ */
+ while ((c = getoldopt(argc, argv,
+- "b:cef:hjmopqruts:vwxzBC:HI:LNOPXZ014578")) != -1) {
++ "b:cef:hjmopqruts:vwxzBC:HI:JLNOPXZ014578")) != -1) {
+ switch (c) {
+ case 'b':
+ /*
+@@ -815,6 +822,12 @@ tar_options(int argc, char **argv)
+ incfiles[nincfiles - 1].file = optarg;
+ incfiles[nincfiles - 1].dir = chdname;
+ break;
++ case 'J':
++ /*
++ * use xz. Non standard option.
++ */
++ gzip_program = XZ_CMD;
++ break;
+ case 'L':
+ /*
+ * follow symlinks
+@@ -1098,7 +1111,7 @@ cpio_options(int argc, char **argv)
+ dflag = 1;
+ act = -1;
+ nodirs = 1;
+- while ((c=getopt(argc,argv,"abcdfijklmoprstuvzABC:E:F:H:I:LO:SZ6")) != -1)
++ while ((c=getopt(argc,argv,"abcdfijklmoprstuvzABC:E:F:H:I:JLO:SZ6")) != -1)
+ switch (c) {
+ case 'a':
+ /*
+@@ -1282,6 +1295,12 @@ cpio_options(int argc, char **argv)
+ (void)fputs("\n\n", stderr);
+ cpio_usage();
+ break;
++ case 'J':
++ /*
++ * use xz. Non standard option.
++ */
++ gzip_program = XZ_CMD;
++ break;
+ case 'L':
+ /*
+ * follow symbolic links
+--
+2.11.0
+
diff --git a/pkg/openbsd/patch/0013-setprogname-Explicitly-discard-const-qualifier.patch b/pkg/openbsd/patch/0013-setprogname-Explicitly-discard-const-qualifier.patch
new file mode 100644
index 00000000..121e10e8
--- /dev/null
+++ b/pkg/openbsd/patch/0013-setprogname-Explicitly-discard-const-qualifier.patch
@@ -0,0 +1,26 @@
+From f976df1b8ad1ed79f25d04eb7285e582690ad965 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sun, 11 Dec 2016 14:36:13 -0800
+Subject: [PATCH] setprogname: Explicitly discard const qualifier
+
+---
+ lib/libc/gen/setprogname.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/libc/gen/setprogname.c b/lib/libc/gen/setprogname.c
+index ec3189fa699..173148ba8cf 100644
+--- a/lib/libc/gen/setprogname.c
++++ b/lib/libc/gen/setprogname.c
+@@ -25,7 +25,7 @@ setprogname(const char *progname)
+
+ tmpn = strrchr(progname, '/');
+ if (tmpn == NULL)
+- __progname = progname;
++ __progname = (char *)progname;
+ else
+- __progname = tmpn + 1;
++ __progname = (char *)tmpn + 1;
+ }
+--
+2.11.0
+