mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-04 09:14:21 +03:00
jp: Use pledge()
This commit is contained in:
parent
9a09437c46
commit
05e772d276
Notes:
sideshowbarker
2024-07-19 09:26:30 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/05e772d276c
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user