From 48257375098707915bc0f81e514774e06bb18d6d Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Tue, 3 Oct 2023 17:57:26 -0700 Subject: [PATCH] Make pledge() less strict about the API We were previously returning EINVAL but OpenBSD allows it. --- libc/calls/pledge.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libc/calls/pledge.c b/libc/calls/pledge.c index 3c423c670..0c2f989bc 100644 --- a/libc/calls/pledge.c +++ b/libc/calls/pledge.c @@ -239,6 +239,9 @@ int pledge(const char *promises, const char *execpromises) { int e, rc; unsigned long ipromises, iexecpromises; + if (promises && !execpromises) { + execpromises = promises; + } if (!promises) { // OpenBSD says NULL argument means it doesn't change, i.e. // pledge(0,0) on OpenBSD does nothing. The Cosmopolitan Libc