Fix unveil(2) usage
Thanks to the feedback by z0lqLA! I forgot that unveil(NULL, NULL) only locks further unveil calls when there has been at least _one_ prior call to unveil! To fix this, we reorder the calls and also make sure to call unveil() before we disallow unveils via pledge. Signed-off-by: Laslo Hunhold <dev@frign.de>
This commit is contained in:
parent
3c7049e906
commit
5ee8c07e7e
1 changed files with 4 additions and 1 deletions
5
main.c
5
main.c
|
@ -387,10 +387,13 @@ main(int argc, char *argv[])
|
||||||
exit(0);
|
exit(0);
|
||||||
default:
|
default:
|
||||||
/* limit ourselves even further while we are waiting */
|
/* limit ourselves even further while we are waiting */
|
||||||
eunveil(NULL, NULL);
|
|
||||||
if (udsname) {
|
if (udsname) {
|
||||||
|
eunveil(udsname, "c");
|
||||||
|
eunveil(NULL, NULL);
|
||||||
epledge("stdio cpath", NULL);
|
epledge("stdio cpath", NULL);
|
||||||
} else {
|
} else {
|
||||||
|
eunveil("/", "");
|
||||||
|
eunveil(NULL, NULL);
|
||||||
epledge("stdio", NULL);
|
epledge("stdio", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue