Make pledge() less strict about the API

We were previously returning EINVAL but OpenBSD allows it.
This commit is contained in:
Justine Tunney 2023-10-03 17:57:26 -07:00
parent 695f74035d
commit 4825737509
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -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