From aecbdfec4f8fa05ac299697e2b15d6c6a80e2766 Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Thu, 14 Dec 2023 19:54:57 +1300 Subject: [PATCH] Add call to pledge() on OpenBSD --- esv.d | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/esv.d b/esv.d index 760f4f8..de6dc6a 100644 --- a/esv.d +++ b/esv.d @@ -48,13 +48,25 @@ bool rFlag, RFlag; /* passage references */ string sFlag; /* search passages */ bool VFlag; /* show version */ +version (OpenBSD) { + immutable(char) *promises; +} + int main(string[] args) { bool success; + version (OpenBSD) { + import core.sys.openbsd.unistd : pledge; + import std.string : toStringz; + + promises = toStringz("stdio rpath wpath cpath inet dns proc exec prot_exec"); + pledge(promises, null); + } + debug { - return run(args); + return run(args) ? 0 : 1; } try {