mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +00:00
more: Use pledge()
This commit is contained in:
parent
e45a4b0931
commit
f7148c766a
1 changed files with 10 additions and 0 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue