Patch to use pledge on OpenBSD.
locale is needed for idn2.

Index: bin/dig/nslookup.c
--- bin/dig/nslookup.c.orig
+++ bin/dig/nslookup.c
@@ -948,6 +948,15 @@ main(int argc, char **argv) {
 	dighost_trying = trying;
 	dighost_shutdown = start_next_command;
 
+	/*
+	 * unix: needed for startup check, isc_net_probeunix.
+	 * (unix sockets used in controlconf).
+	 */
+	if (pledge("stdio rpath inet unix dns unveil", NULL) == -1) {
+		perror("pledge");
+		exit(1);
+	}
+
 	setup_libs();
 	progname = argv[0];
 
@@ -958,6 +967,21 @@ main(int argc, char **argv) {
 	} else if (keysecret[0] != 0) {
 		setup_text_key();
 	}
+
+	if (unveil("/usr/share/locale", "r") == -1) {
+		perror("unveil /usr/share/locale");
+		exit(1);
+	}
+	/*
+	 * dns:   resolv.conf, also allows port 53 sockets
+	 * inet:  needed if we query on port != 53
+	 * rpath: locale
+	 */
+	if (pledge("stdio rpath inet dns", NULL) == -1) {
+		perror("pledge");
+		exit(1);
+	}
+
 	if (domainopt[0] != '\0') {
 		set_search_domain(domainopt);
 	}
