mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
tail: Use pledge()
This commit is contained in:
parent
0c44a12247
commit
70defb34e6
Notes:
sideshowbarker
2024-07-19 10:06:33 +09:00
Author: https://github.com/bgianfo 🔰 Commit: https://github.com/SerenityOS/serenity/commit/70defb34e65 Pull-request: https://github.com/SerenityOS/serenity/pull/1065
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user