summary refs log tree commit diff
path: root/bin/hilex.c
diff options
context:
space:
mode:
authorC. McEnroe <june@causal.agency>2021-09-30 02:35:03 +0000
committerC. McEnroe <june@causal.agency>2021-09-30 02:38:53 +0000
commiteb3a5999bd26aa762687a23dd122f4eb56463b9c (patch)
treedcc3146b5a3f4ff02af680ba853b5f693faa8ad5 /bin/hilex.c
parentRemove link to gopher (diff)
downloadsrc-eb3a5999bd26aa762687a23dd122f4eb56463b9c.tar.gz
src-eb3a5999bd26aa762687a23dd122f4eb56463b9c.zip
pledge(2) hilex
Diffstat (limited to '')
-rw-r--r--bin/hilex.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/hilex.c b/bin/hilex.c
index 91a5e88..0bcc5c7 100644
--- a/bin/hilex.c
+++ b/bin/hilex.c
@@ -149,6 +149,11 @@ static void ansiHeader(const char *opts[]) {
 	close(rw[0]);
 	close(rw[1]);
 	setlinebuf(stdout);
+
+#ifdef __OpenBSD__
+	error = pledge("stdio", NULL);
+	if (error) err(EX_OSERR, "pledge");
+#endif
 }
 
 static void ansiFooter(const char *opts[]) {
@@ -369,6 +374,16 @@ int main(int argc, char *argv[]) {
 		pager = isatty(STDOUT_FILENO);
 	}
 
+#ifdef __OpenBSD__
+	int error;
+	if (formatter->header == ansiHeader && pager) {
+		error = pledge("stdio proc exec", NULL);
+	} else {
+		error = pledge("stdio", NULL);
+	}
+	if (error) err(EX_OSERR, "pledge");
+#endif
+
 	if (!name) {
 		if (NULL != (name = strrchr(path, '/'))) {
 			name++;