$OpenBSD: patch-source_tools_mudraw_c,v 1.4 2017/05/05 14:02:51 sthen Exp $

add pledge(2) to "mutool draw":
  - wpath cpath : only if output is specified

Index: source/tools/mudraw.c
--- source/tools/mudraw.c.orig
+++ source/tools/mudraw.c
@@ -1385,6 +1385,23 @@ int mudraw_main(int argc, char **argv)
 	if (fz_optind == argc)
 		usage();
 
+	if (output && output[0] != '-' && *output != 0)
+	{
+		if (pledge("stdio rpath wpath cpath", NULL) == -1)
+		{
+			fprintf(stderr, "pledge: %s\n", strerror(errno));
+			exit(1);
+		}
+	}
+	else
+	{
+		if (pledge("stdio rpath", NULL) == -1)
+		{
+			fprintf(stderr, "pledge: %s\n", strerror(errno));
+			exit(1);
+		}
+	}
+
 	if (num_workers > 0)
 	{
 		if (uselist == 0)
