str(1): adds null unveil

This commit is contained in:
Emma Tebibyte 2024-08-28 00:30:45 -06:00
parent 6166a3ca36
commit 41982c2f73
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -25,7 +25,7 @@
#include <sysexits.h> /* EX_OSERR, EX_USAGE */ #include <sysexits.h> /* EX_OSERR, EX_USAGE */
#ifdef __OpenBSD__ #ifdef __OpenBSD__
# include <unistd.h> /* pledge(2) */ # include <unistd.h> /* pledge(2), unveil(2) */
#endif #endif
char *program_name = "str"; char *program_name = "str";
@ -62,7 +62,7 @@ int main(int argc, char *argv[]) {
program_name = argv[0] == NULL ? program_name : argv[0]; program_name = argv[0] == NULL ? program_name : argv[0];
#ifdef __OpenBSD__ #ifdef __OpenBSD__
if (pledge("stdio", NULL) == -1) { if (pledge("stdio unveil", NULL) == -1 || unveil(NULL, NULL) == -1) {
perror(program_name); perror(program_name);
return EX_OSERR; return EX_OSERR;
} }