openbsd-ports/textproc/mupdf/patches/patch-source_tools_pdfclean_c
2019-07-30 13:41:14 +00:00

30 lines
737 B
Plaintext

$OpenBSD: patch-source_tools_pdfclean_c,v 1.6 2019/07/30 13:41:14 sthen Exp $
add pledge(2) to "mutool clean"
Index: source/tools/pdfclean.c
--- source/tools/pdfclean.c.orig
+++ source/tools/pdfclean.c
@@ -12,6 +12,8 @@
#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <unistd.h>
+#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -103,6 +105,12 @@ int pdfclean_main(int argc, char **argv)
(strstr(argv[fz_optind], ".pdf") || strstr(argv[fz_optind], ".PDF")))
{
outfile = 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);