commit: 9a9f25b61bf9b8bd5c416c5aa7c9740358dba308
parent 0e46344b5f8ff15224140d961f62a731e8a36d1f
Author: Michael Forney <mforney@mforney.org>
Date: Sat, 15 Jun 2019 20:09:00 -0700
openbsd: Fix a few portability issues
Diffstat:
4 files changed, 230 insertions(+), 6 deletions(-)
diff --git a/pkg/openbsd/patch/0022-m4-Add-missing-includes.patch b/pkg/openbsd/patch/0022-m4-Add-missing-includes.patch
@@ -1,12 +1,13 @@
-From 2213572d0ef5646c205f5d30e67ba7ad1ac0129e Mon Sep 17 00:00:00 2001
+From 3cc2a61c553d138778a6ec1dd84cd042ce834b4e Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Tue, 10 Apr 2018 16:24:12 -0700
Subject: [PATCH] m4: Add missing includes
---
- usr.bin/m4/look.c | 1 +
- usr.bin/m4/main.c | 1 +
- 2 files changed, 2 insertions(+)
+ usr.bin/m4/look.c | 1 +
+ usr.bin/m4/main.c | 1 +
+ usr.bin/m4/parser.y | 1 +
+ 3 files changed, 3 insertions(+)
diff --git a/usr.bin/m4/look.c b/usr.bin/m4/look.c
index ac504570a9f..5feb0413cd6 100644
@@ -32,6 +33,18 @@ index f1b8fa5a55b..4e664c0a50b 100644
#include <assert.h>
#include <signal.h>
#include <err.h>
+diff --git a/usr.bin/m4/parser.y b/usr.bin/m4/parser.y
+index 5b46d261a9a..fedded1e44c 100644
+--- a/usr.bin/m4/parser.y
++++ b/usr.bin/m4/parser.y
+@@ -17,6 +17,7 @@
+ */
+ #include <math.h>
+ #include <stdint.h>
++#include <stdlib.h>
+ #define YYSTYPE int32_t
+ extern int32_t end_result;
+ extern int yylex(void);
--
-2.17.0
+2.22.0
diff --git a/pkg/openbsd/patch/0028-rsync-Avoid-pointer-arithmetic-on-void.patch b/pkg/openbsd/patch/0028-rsync-Avoid-pointer-arithmetic-on-void.patch
@@ -0,0 +1,155 @@
+From 33c8f9c16352f016423b4f67ec851318506c17e3 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sat, 15 Jun 2019 20:06:13 -0700
+Subject: [PATCH] rsync: Avoid pointer arithmetic on `void *`
+
+---
+ usr.bin/rsync/blocks.c | 6 +++---
+ usr.bin/rsync/downloader.c | 2 +-
+ usr.bin/rsync/io.c | 12 ++++++------
+ usr.bin/rsync/sender.c | 4 ++--
+ usr.bin/rsync/uploader.c | 4 ++--
+ 5 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/usr.bin/rsync/blocks.c b/usr.bin/rsync/blocks.c
+index d02f4f40b4b..9c163600307 100644
+--- a/usr.bin/rsync/blocks.c
++++ b/usr.bin/rsync/blocks.c
+@@ -54,7 +54,7 @@ blk_find(struct sess *sess, const void *buf, off_t size, off_t offs,
+ remain = size - offs;
+ assert(remain);
+ osz = remain < (off_t)blks->len ? remain : (off_t)blks->len;
+- fhash = hash_fast(buf + offs, (size_t)osz);
++ fhash = hash_fast((char *)buf + offs, (size_t)osz);
+ have_md = 0;
+
+ /*
+@@ -65,7 +65,7 @@ blk_find(struct sess *sess, const void *buf, off_t size, off_t offs,
+ if (hint < blks->blksz &&
+ fhash == blks->blks[hint].chksum_short &&
+ (size_t)osz == blks->blks[hint].len) {
+- hash_slow(buf + offs, (size_t)osz, md, sess);
++ hash_slow((char *)buf + offs, (size_t)osz, md, sess);
+ have_md = 1;
+ if (memcmp(md, blks->blks[hint].chksum_long, blks->csum) == 0) {
+ LOG4(sess, "%s: found matching hinted match: "
+@@ -99,7 +99,7 @@ blk_find(struct sess *sess, const void *buf, off_t size, off_t offs,
+ /* Compute slow hash on demand. */
+
+ if (have_md == 0) {
+- hash_slow(buf + offs, (size_t)osz, md, sess);
++ hash_slow((char *)buf + offs, (size_t)osz, md, sess);
+ have_md = 1;
+ }
+
+diff --git a/usr.bin/rsync/downloader.c b/usr.bin/rsync/downloader.c
+index 405f7623759..f47c895957d 100644
+--- a/usr.bin/rsync/downloader.c
++++ b/usr.bin/rsync/downloader.c
+@@ -497,7 +497,7 @@ again:
+ sz = tok == p->blk.blksz - 1 ? p->blk.rem : p->blk.len;
+ assert(sz);
+ assert(p->map != MAP_FAILED);
+- buf = p->map + (tok * p->blk.len);
++ buf = (char *)p->map + (tok * p->blk.len);
+
+ /*
+ * Now we read from our block.
+diff --git a/usr.bin/rsync/io.c b/usr.bin/rsync/io.c
+index 0e451226d31..404e7bf4112 100644
+--- a/usr.bin/rsync/io.c
++++ b/usr.bin/rsync/io.c
+@@ -117,7 +117,7 @@ io_write_blocking(struct sess *sess, int fd, const void *buf, size_t sz)
+ ERRX(sess, "io_write_nonblocking: short write");
+ return 0;
+ }
+- buf += wsz;
++ buf = (char *)buf + wsz;
+ sz -= wsz;
+ }
+
+@@ -156,7 +156,7 @@ io_write_buf(struct sess *sess, int fd, const void *buf, size_t sz)
+ }
+ sess->total_write += wsz;
+ sz -= wsz;
+- buf += wsz;
++ buf = (char *)buf + wsz;
+ }
+
+ return 1;
+@@ -252,7 +252,7 @@ io_read_blocking(struct sess *sess,
+ ERRX(sess, "io_read_nonblocking: short read");
+ return 0;
+ }
+- buf += rsz;
++ buf = (char *)buf + rsz;
+ sz -= rsz;
+ }
+
+@@ -369,7 +369,7 @@ io_read_buf(struct sess *sess, int fd, void *buf, size_t sz)
+ }
+ sz -= rsz;
+ sess->mplex_read_remain -= rsz;
+- buf += rsz;
++ buf = (char *)buf + rsz;
+ sess->total_read += rsz;
+ continue;
+ }
+@@ -465,7 +465,7 @@ io_buffer_buf(struct sess *sess, void *buf,
+ {
+
+ assert(*bufpos + valsz <= buflen);
+- memcpy(buf + *bufpos, val, valsz);
++ memcpy((char *)buf + *bufpos, val, valsz);
+ *bufpos += valsz;
+ }
+
+@@ -664,7 +664,7 @@ io_unbuffer_buf(struct sess *sess, const void *buf,
+ {
+
+ assert(*bufpos + valsz <= bufsz);
+- memcpy(val, buf + *bufpos, valsz);
++ memcpy(val, (char *)buf + *bufpos, valsz);
+ *bufpos += valsz;
+ }
+
+diff --git a/usr.bin/rsync/sender.c b/usr.bin/rsync/sender.c
+index ab7221a87d7..8b48ab7cc81 100644
+--- a/usr.bin/rsync/sender.c
++++ b/usr.bin/rsync/sender.c
+@@ -128,7 +128,7 @@ send_up_fsm(struct sess *sess, size_t *phase,
+ return 0;
+ }
+ io_lowbuffer_buf(sess, *wb, &pos, *wbsz,
+- up->stat.map + up->stat.curpos, sz);
++ (char *)up->stat.map + up->stat.curpos, sz);
+
+ up->stat.curpos += sz;
+ if (up->stat.curpos == up->stat.curlen)
+@@ -568,7 +568,7 @@ rsync_sender(struct sess *sess, int fdin,
+ assert(pfd[2].fd == -1);
+ assert(wbufsz - wbufpos);
+ ssz = write(fdout,
+- wbuf + wbufpos, wbufsz - wbufpos);
++ (char *)wbuf + wbufpos, wbufsz - wbufpos);
+ if (ssz < 0) {
+ ERR(sess, "write");
+ goto out;
+diff --git a/usr.bin/rsync/uploader.c b/usr.bin/rsync/uploader.c
+index 70aab10e6f5..c6e5ebf4d7a 100644
+--- a/usr.bin/rsync/uploader.c
++++ b/usr.bin/rsync/uploader.c
+@@ -158,8 +158,8 @@ init_blk(struct blk *p, const struct blkset *set, off_t offs,
+ p->len = idx < set->blksz - 1 ? set->len : set->rem;
+ p->offs = offs;
+
+- p->chksum_short = hash_fast(map + offs, p->len);
+- hash_slow(map + offs, p->len, p->chksum_long, sess);
++ p->chksum_short = hash_fast((char *)map + offs, p->len);
++ hash_slow((char *)map + offs, p->len, p->chksum_long, sess);
+ }
+
+ /*
+--
+2.22.0
+
diff --git a/pkg/openbsd/patch/0029-acme-client-Prevent-duplicate-definitions-of-global-.patch b/pkg/openbsd/patch/0029-acme-client-Prevent-duplicate-definitions-of-global-.patch
@@ -0,0 +1,56 @@
+From 6f080695f603d1a5f2ddb8c251c146cf9be59463 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sat, 15 Jun 2019 20:20:36 -0700
+Subject: [PATCH] acme-client: Prevent duplicate definitions of global
+ variables
+
+---
+ usr.sbin/acme-client/extern.h | 4 ++--
+ usr.sbin/acme-client/main.c | 5 +++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/usr.sbin/acme-client/extern.h b/usr.sbin/acme-client/extern.h
+index cf0abbdfb2c..1ea82ec0b8e 100644
+--- a/usr.sbin/acme-client/extern.h
++++ b/usr.sbin/acme-client/extern.h
+@@ -253,12 +253,12 @@ char *json_fmt_signed(const char *,
+ /*
+ * Should we print debugging messages?
+ */
+-int verbose;
++extern int verbose;
+
+ /*
+ * What component is the process within (COMP__MAX for none)?
+ */
+-enum comp proccomp;
++extern enum comp proccomp;
+
+ __END_DECLS
+
+diff --git a/usr.sbin/acme-client/main.c b/usr.sbin/acme-client/main.c
+index bbedeb76357..d98d7560174 100644
+--- a/usr.sbin/acme-client/main.c
++++ b/usr.sbin/acme-client/main.c
+@@ -32,6 +32,9 @@
+ #define WWW_DIR "/var/www/acme"
+ #define CONF_FILE "/etc/acme-client.conf"
+
++int verbose;
++enum comp proccomp;
++
+ int
+ main(int argc, char *argv[])
+ {
+@@ -48,8 +51,6 @@ main(int argc, char *argv[])
+ int c, rc, revocate = 0;
+ int popts = 0;
+ pid_t pids[COMP__MAX];
+- extern int verbose;
+- extern enum comp proccomp;
+ size_t i, altsz, ne;
+
+ struct acme_conf *conf = NULL;
+--
+2.22.0
+
diff --git a/pkg/openbsd/ver b/pkg/openbsd/ver
@@ -1 +1 @@
-6.5 r1
+6.5 r2