Some test fixes, and introduce some pledge and unveil for OpenBSD.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4851 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-02-17 14:55:39 +00:00
parent 9af4068bb6
commit dca48fae36
3 changed files with 65 additions and 3 deletions

View File

@ -395,6 +395,21 @@ static void _shed_privileges()
}
#endif
#endif
#if defined(__OpenBSD__)
/* How do I unveil nothing? */
if (unveil("/dev/null", "r") ||
unveil(NULL, NULL))
{
perror("unveil");
exit(-1);
}
if (pledge("stdio unveil", NULL))
{
perror("pledge");
exit(-1);
}
#endif
}
static int _tf_command_run(const char* file, int argc, char* argv[])