summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-11 20:50:22 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-11 21:33:12 +0100
commite131a401e894bd484193323d6991a7631b4f53b8 (patch)
treeee986ad98485e59fe01d2e8930ff9c645477b6ac /Userland
parent1934a1ec0beee6e9472cb336ebc2566de66cd674 (diff)
downloadserenity-e131a401e894bd484193323d6991a7631b4f53b8.zip
cat: Use pledge()
Diffstat (limited to 'Userland')
-rw-r--r--Userland/cat.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/cat.cpp b/Userland/cat.cpp
index 0e8110fdab..5fcd739ec0 100644
--- a/Userland/cat.cpp
+++ b/Userland/cat.cpp
@@ -9,6 +9,11 @@
int main(int argc, char** argv)
{
+ if (pledge("stdio rpath", nullptr) < 0) {
+ perror("pledge");
+ return 1;
+ }
+
Vector<int> fds;
if (argc > 1) {
for (int i = 1; i < argc; i++) {
@@ -22,6 +27,12 @@ int main(int argc, char** argv)
} else {
fds.append(0);
}
+
+ if (pledge("stdio", nullptr) < 0) {
+ perror("pledge");
+ return 1;
+ }
+
for (auto& fd : fds) {
for (;;) {
char buf[32768];