jp: Use pledge()

This commit is contained in:
Andreas Kling 2020-02-11 12:16:07 +01:00
parent 9a09437c46
commit 05e772d276
Notes: sideshowbarker 2024-07-19 09:26:30 +09:00

View File

@ -30,6 +30,7 @@
#include <AK/StringBuilder.h>
#include <LibCore/File.h>
#include <stdio.h>
#include <unistd.h>
static void print(const JsonValue& value, int indent = 0);
static void print_indent(int indent)
@ -40,6 +41,11 @@ static void print_indent(int indent)
int main(int argc, char** argv)
{
if (pledge("stdio rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
if (argc != 2) {
fprintf(stderr, "usage: jp <file>\n");
return 0;
@ -50,6 +56,11 @@ int main(int argc, char** argv)
return 1;
}
if (pledge("stdio", nullptr) < 0) {
perror("pledge");
return 1;
}
auto file_contents = file->read_all();
auto json = JsonValue::from_string(file_contents);