bsdiff-portable

A more portable version of Colin Percival's bsdiff
git clone git://git.sgregoratto.me/bsdiff-portable
Log | Files | Refs | LICENSE

commit 9496546ec6bbc16ba0ad4db9bb002ec3c7f43609
parent 0fd2652cab5bb7ae8ca7c06130d33b4300953a18
Author: Stephen Gregoratto <dev@sgregoratto.me>
Date:   Wed, 23 Sep 2020 23:02:43 +1000

bsdiff: pledge earlier

Diffstat:
Mbsdiff.c | 13++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/bsdiff.c b/bsdiff.c @@ -99,13 +99,6 @@ main(int argc, char **argv) if (pledge("stdio wpath cpath", NULL) == -1) err(1, "pledge"); #endif - - if ((db = reallocarray(NULL, oldsize + 1, sizeof(off_t))) == NULL) - err(1, "reallocarray"); - if ((eb = reallocarray(NULL, oldsize + 1, sizeof(off_t))) == NULL) - err(1, "reallocarray"); - dblen = eblen = 0; - /* Create the patch file */ if ((pf = fopen(argv[3], "w")) == NULL) err(1, "fopen(%s)", argv[3]); @@ -114,6 +107,12 @@ main(int argc, char **argv) err(1, "pledge"); #endif + if ((db = reallocarray(NULL, oldsize + 1, sizeof(off_t))) == NULL) + err(1, "reallocarray"); + if ((eb = reallocarray(NULL, oldsize + 1, sizeof(off_t))) == NULL) + err(1, "reallocarray"); + dblen = eblen = 0; + /* Header is 0 8 "BSDIFF40" 8 8 length of bzip2ed ctrl block