summaryrefslogtreecommitdiff
path: root/Userland/ps.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-18 10:42:04 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-18 11:35:47 +0100
commitffb60566750d5560f6c6677d5366f0649f826238 (patch)
treea50369427436b5ddd206d7d71306bf5a43aa4c97 /Userland/ps.cpp
parent16d5b1d4ca8e54c28c85ab39c08461dbda0f8848 (diff)
downloadserenity-ffb60566750d5560f6c6677d5366f0649f826238.zip
ps: Use pledge() and unveil()
Diffstat (limited to 'Userland/ps.cpp')
-rw-r--r--Userland/ps.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/Userland/ps.cpp b/Userland/ps.cpp
index 5ffb8ff20f..068e394ebd 100644
--- a/Userland/ps.cpp
+++ b/Userland/ps.cpp
@@ -32,6 +32,23 @@
int main(int argc, char** argv)
{
+ if (pledge("stdio rpath", nullptr) < 0) {
+ perror("pledge");
+ return 1;
+ }
+
+ if (unveil("/proc/all", "r") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ if (unveil("/etc/passwd", "r") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ unveil(nullptr, nullptr);
+
(void)argc;
(void)argv;