summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Coles <bcoles@gmail.com>2021-01-12 06:37:40 +0000
committerAndreas Kling <kling@serenityos.org>2021-01-12 08:58:59 +0100
commiteece9edd910e1878f0bef3fec26f384070ce392a (patch)
treeee59fd239f83b2fd95dd0f788549fb2744d67cb6
parenteeffdb9725f1120c88c6be795f1f0a46cce10eb5 (diff)
downloadserenity-eece9edd910e1878f0bef3fec26f384070ce392a.zip
useradd: Use pledge()
-rw-r--r--Userland/useradd.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/useradd.cpp b/Userland/useradd.cpp
index 995027707f..627e1209f2 100644
--- a/Userland/useradd.cpp
+++ b/Userland/useradd.cpp
@@ -39,6 +39,11 @@ constexpr const char* DEFAULT_SHELL = "/bin/Shell";
int main(int argc, char** argv)
{
+ if (pledge("stdio wpath rpath cpath chown", nullptr) < 0) {
+ perror("pledge");
+ return 1;
+ }
+
const char* home_path = nullptr;
int uid = 0;
int gid = USERS_GID;