whoami: Use pledge() and unveil()

This commit is contained in:
Andreas Kling 2020-02-18 11:01:31 +01:00
commit 4f7081289c
Notes: sideshowbarker 2024-07-19 09:14:34 +09:00

View file

@ -29,6 +29,18 @@
int main(int, char**)
{
if (pledge("stdio rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
if (unveil("/etc/passwd", "r") < 0) {
perror("unveil");
return 1;
}
unveil(nullptr, nullptr);
puts(getlogin());
return 0;
}