openbsd-ports/textproc/mupdf/patches/patch-source_tools_pdfextract_c
2022-03-07 21:36:41 +00:00

31 lines
687 B
Plaintext

add pledge(2) to "mutool extract"
Index: source/tools/pdfextract.c
--- source/tools/pdfextract.c.orig
+++ source/tools/pdfextract.c
@@ -27,8 +27,11 @@
#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <unistd.h>
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
static pdf_document *doc = NULL;
static fz_context *ctx = NULL;
@@ -295,6 +298,12 @@ int pdfextract_main(int argc, char **argv)
return usage();
infile = argv[fz_optind++];
+
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ {
+ fprintf(stderr, "pledge: %s\n", strerror(errno));
+ exit(1);
+ }
ctx = fz_new_context(NULL, NULL, FZ_STORE_UNLIMITED);
if (!ctx)