From 70defb34e6504e49dcc3eee17df4a0d1d2a7dd35 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 12 Jan 2020 16:11:47 -0800 Subject: [PATCH] tail: Use pledge() --- Userland/tail.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Userland/tail.cpp b/Userland/tail.cpp index ac623f46ed5..e7d66fd0329 100644 --- a/Userland/tail.cpp +++ b/Userland/tail.cpp @@ -70,6 +70,11 @@ off_t find_seek_pos(CFile& file, int wanted_lines) int main(int argc, char* argv[]) { + if (pledge("stdio rpath", nullptr) < 0) { + perror("pledge"); + return 1; + } + CArgsParser args_parser("tail"); args_parser.add_arg("f", "follow -- appended data is output as it is written to the file"); @@ -101,6 +106,11 @@ int main(int argc, char* argv[]) exit(1); } + if (pledge("stdio", nullptr) < 0) { + perror("pledge"); + return 1; + } + bool flag_follow = args.is_present("f"); auto pos = find_seek_pos(*f, line_count); return tail_from_pos(*f, pos, flag_follow);