From 4f7081289c65f6a3bccb4c133417773c4a8ae27b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 18 Feb 2020 11:01:31 +0100 Subject: [PATCH] whoami: Use pledge() and unveil() --- Userland/whoami.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Userland/whoami.cpp b/Userland/whoami.cpp index ffb1aefbb9..830d1796ba 100644 --- a/Userland/whoami.cpp +++ b/Userland/whoami.cpp @@ -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; }