strcmp(1): adds null unveil

This commit is contained in:
Emma Tebibyte 2024-08-28 00:31:02 -06:00
parent 41982c2f73
commit 9f520df82b
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -20,7 +20,7 @@
#include <sysexits.h> /* EX_OK, EX_OSERR, EX_USAGE */ #include <sysexits.h> /* EX_OK, 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 = "strcmp"; char *program_name = "strcmp";
@ -29,7 +29,7 @@ int main(int argc, char *argv[]) {
unsigned int i; unsigned int i;
#ifdef __OpenBSD__ #ifdef __OpenBSD__
if (pledge("stdio", NULL) == -1) { if (pledge("stdio unveil", NULL) == -1 || unveil(NULL, NULL) == -1) {
perror(argv[0] == NULL ? program_name : argv[0]); perror(argv[0] == NULL ? program_name : argv[0]);
return EX_OSERR; return EX_OSERR;