OpenBSD Pledge support

FossilOrigin-Name: 8cedfc5118348282ee78d14830a8d64326a62f91d34492e2f6b31e924cda0d5d
This commit is contained in:
nekobit 2023-06-01 01:10:47 +00:00
parent d4cd539019
commit 9b476d3ab5
2 changed files with 13 additions and 1 deletions

View file

@ -13,6 +13,8 @@ test/tests
scripts/*.o
templates/*.ctt
test/unit/*.bin
treebird.core
filec.core
compile_commands.json
build/
obj/

View file

@ -5,6 +5,9 @@
*/
#include "global_perl.h"
#ifdef __OpenBSD__
# include <unistd.h>
#endif
#include <pthread.h>
#include <string.h>
#include "memory.h"
@ -272,6 +275,14 @@ int main(int argc, char **argv, char **env)
#endif
#ifdef __OpenBSD__
if (pledge("stdio rpath inet dns unveil prot_exec", "") == -1)
{
perror("pledge");
exit(2);
}
#endif
// Global init
mstdnt_global_curl_init();
#ifndef CGI_MODE
@ -281,7 +292,6 @@ int main(int argc, char **argv, char **env)
}
#endif
// Initialize Perl
PERL_SYS_INIT3(&argc, &argv, &env);
my_perl = perl_alloc();