Compare commits

...

7 Commits

6 changed files with 8 additions and 10 deletions

View File

@ -8,13 +8,12 @@
*/ */
#ifdef __OpenBSD__ #ifdef __OpenBSD__
# include <unistd.h> /* NULL, pledge(2), unveil(2) */ # include <unistd.h> /* pledge(2) */
#endif #endif
int main(void) { int main(void) {
#ifdef __OpenBSD__ #ifdef __OpenBSD__
(void)pledge(NULL, NULL); (void)pledge("stdio", "");
(void)unveil(NULL, NULL);
#endif #endif
return 1; return 1;
} }

View File

@ -44,7 +44,7 @@ int main(int argc, char *argv[]) {
char showtab = 0; /* prints tab characters in caret notation */ char showtab = 0; /* prints tab characters in caret notation */
#ifdef __OpenBSD__ #ifdef __OpenBSD__
if (pledge("stdio unveil", NULL) == -1 || unveil(NULL, NULL)) { if (pledge("stdio unveil", "") == -1 || unveil(NULL, NULL)) {
perror(argv[0] == NULL ? program_name : argv[0]); perror(argv[0] == NULL ? program_name : argv[0]);
return EX_OSERR; return EX_OSERR;
} }

View File

@ -46,7 +46,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("rpath stdio unveil", NULL) == -1) { if (pledge("rpath stdio unveil", "") == -1) {
perror(program_name); perror(program_name);
return EX_OSERR; return EX_OSERR;
} }

View File

@ -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 unveil", NULL) == -1 || unveil(NULL, NULL) == -1) { if (pledge("stdio unveil", "") == -1 || unveil(NULL, NULL) == -1) {
perror(program_name); perror(program_name);
return EX_OSERR; return EX_OSERR;
} }

View File

@ -29,7 +29,7 @@ int main(int argc, char *argv[]) {
unsigned int i; unsigned int i;
#ifdef __OpenBSD__ #ifdef __OpenBSD__
if (pledge("stdio unveil", NULL) == -1 || unveil(NULL, NULL) == -1) { if (pledge("stdio unveil", "") == -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;

View File

@ -8,12 +8,11 @@
*/ */
#ifdef __OpenBSD__ #ifdef __OpenBSD__
# include <unistd.h> /* NULL, pledge(2), unveil(2) */ # include <unistd.h> /* pledge(2) */
#endif #endif
int main(void) { int main(void) {
#ifdef __OpenBSD__ #ifdef __OpenBSD__
(void)pledge(NULL, NULL); (void)pledge("stdio", "");
(void)unveil(NULL, NULL);
#endif #endif
} }