summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gianforcaro <b.gianfo@gmail.com>2020-01-12 16:27:22 -0800
committerAndreas Kling <awesomekling@gmail.com>2020-01-13 11:04:35 +0100
commitf7148c766aa0541341ba29c11178041321347ae9 (patch)
tree18e1164c94e9f25064d516504e7ecc0a584ddfea
parente45a4b0931045ef5b0380918e3459e600243e2ed (diff)
downloadserenity-f7148c766aa0541341ba29c11178041321347ae9.zip
more: Use pledge()
-rw-r--r--Userland/more.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/more.cpp b/Userland/more.cpp
index 79c165b540..8d95532aba 100644
--- a/Userland/more.cpp
+++ b/Userland/more.cpp
@@ -19,6 +19,11 @@ int main(int argc, char** argv)
(void)argc;
(void)argv;
+ if (pledge("stdio rpath tty", nullptr) < 0) {
+ perror("pledge");
+ return 1;
+ }
+
key_fd = open(ttyname(1), O_RDONLY);
if (key_fd < 0) {
perror("open");
@@ -28,6 +33,11 @@ int main(int argc, char** argv)
struct winsize ws;
ioctl(1, TIOCGWINSZ, &ws);
+ if (pledge("stdio", nullptr) < 0) {
+ perror("pledge");
+ return 1;
+ }
+
unsigned lines_printed = 0;
while (!feof(stdin)) {
char buffer[BUFSIZ];