npc(1): adds null unveil

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

View File

@ -20,7 +20,7 @@
#include <stdio.h> /* fprintf(3), fputs(3), getc(3), perror(3), putc(3), stdin,
* stdout, EOF */
#include <sysexits.h> /* EX_IOERR, EX_OK, EX_OSERR, EX_USAGE */
#include <unistd.h> /* pledge(2), getopt(3) */
#include <unistd.h> /* NULL, getopt(3), pledge(2), unveil(2) */
char *program_name = "npc";
@ -44,7 +44,7 @@ int main(int argc, char *argv[]) {
char showtab = 0; /* prints tab characters in caret notation */
#ifdef __OpenBSD__
if (pledge("stdio", NULL) == -1) {
if (pledge("stdio unveil", NULL) == -1 || unveil(NULL, NULL)) {
perror(argv[0] == NULL ? program_name : argv[0]);
return EX_OSERR;
}