Add ifdef OpenBSD for pledge/unveil, so it should compile on other OSes

This commit is contained in:
Solene Rapenne 2020-12-01 23:41:55 +01:00
parent c2d813c0f1
commit ddb799c866
1 changed files with 2 additions and 0 deletions

2
main.c
View File

@ -112,11 +112,13 @@ main(int argc, char **argv)
if(strlen(path) == 0)
strlcpy(path, DEFAULT_CHROOT, sizeof(DEFAULT_CHROOT));
#ifdef __OpenBSD__
if (unveil(path, "r") == -1)
err(1, "unveil");
if (pledge("stdio rpath", NULL) == -1)
err(1, "pledge");
#endif
/*
* read 1024 chars from stdin