1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 11:44:58 +00:00

Utilities: Use default execpromises parameter to pledge(..)

This commit is contained in:
Brian Gianforcaro 2022-04-03 16:16:06 -07:00 committed by Brian Gianforcaro
parent 4d0317ae7a
commit af3751e4dd
18 changed files with 21 additions and 21 deletions

View file

@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
TRY(Core::System::unveil(Core::File::absolute_path(path), "r")); TRY(Core::System::unveil(Core::File::absolute_path(path), "r"));
TRY(Core::System::unveil(nullptr, nullptr)); TRY(Core::System::unveil(nullptr, nullptr));
TRY(Core::System::pledge("stdio recvfd rpath", nullptr)); TRY(Core::System::pledge("stdio recvfd rpath"));
auto maybe_loader = Audio::Loader::create(path); auto maybe_loader = Audio::Loader::create(path);
if (maybe_loader.is_error()) { if (maybe_loader.is_error()) {

View file

@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments); args_parser.parse(arguments);
TRY(Core::System::unveil(nullptr, nullptr)); TRY(Core::System::unveil(nullptr, nullptr));
TRY(Core::System::pledge("stdio rpath wpath recvfd", nullptr)); TRY(Core::System::pledge("stdio rpath wpath recvfd"));
if (command.equals_ignoring_case("get") || command == "g") { if (command.equals_ignoring_case("get") || command == "g") {
// Get variables // Get variables

View file

@ -14,7 +14,7 @@
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
TRY(Core::System::pledge("stdio rpath", nullptr)); TRY(Core::System::pledge("stdio rpath"));
auto program_name = LexicalPath::basename(arguments.strings[0]); auto program_name = LexicalPath::basename(arguments.strings[0]);
auto hash_kind = Crypto::Hash::HashKind::None; auto hash_kind = Crypto::Hash::HashKind::None;

View file

@ -13,7 +13,7 @@
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
TRY(Core::System::pledge("stdio rpath chown", nullptr)); TRY(Core::System::pledge("stdio rpath chown"));
char const* gid_arg = nullptr; char const* gid_arg = nullptr;
char const* path = nullptr; char const* path = nullptr;

View file

@ -18,7 +18,7 @@
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
TRY(Core::System::pledge("stdio rpath chown", nullptr)); TRY(Core::System::pledge("stdio rpath chown"));
String spec; String spec;
String path; String path;

View file

@ -10,7 +10,7 @@
ErrorOr<int> serenity_main(Main::Arguments) ErrorOr<int> serenity_main(Main::Arguments)
{ {
TRY(Core::System::pledge("stdio", nullptr)); TRY(Core::System::pledge("stdio"));
printf("\033[3J\033[H\033[2J"); printf("\033[3J\033[H\033[2J");
fflush(stdout); fflush(stdout);
return 0; return 0;

View file

@ -18,7 +18,7 @@
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
TRY(Core::System::pledge("stdio rpath", nullptr)); TRY(Core::System::pledge("stdio rpath"));
String file1_path, file2_path; String file1_path, file2_path;
bool suppress_col1 { false }; bool suppress_col1 { false };

View file

@ -13,7 +13,7 @@
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
TRY(Core::System::pledge("stdio settime rpath", nullptr)); TRY(Core::System::pledge("stdio settime rpath"));
bool print_unix_date = false; bool print_unix_date = false;
bool print_iso_8601 = false; bool print_iso_8601 = false;

View file

@ -49,7 +49,7 @@ ErrorOr<bool> format_file(StringView path, bool inplace)
ErrorOr<int> serenity_main(Main::Arguments args) ErrorOr<int> serenity_main(Main::Arguments args)
{ {
#ifdef __serenity__ #ifdef __serenity__
TRY(Core::System::pledge("stdio rpath wpath cpath", nullptr)); TRY(Core::System::pledge("stdio rpath wpath cpath"));
#endif #endif
bool inplace = false; bool inplace = false;
@ -63,7 +63,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
#ifdef __serenity__ #ifdef __serenity__
if (!inplace) if (!inplace)
TRY(Core::System::pledge("stdio rpath", nullptr)); TRY(Core::System::pledge("stdio rpath"));
#endif #endif
if (files.is_empty()) if (files.is_empty())

View file

@ -35,7 +35,7 @@ void fail(StringView format, Ts... args)
ErrorOr<int> serenity_main(Main::Arguments args) ErrorOr<int> serenity_main(Main::Arguments args)
{ {
TRY(Core::System::pledge("stdio rpath", nullptr)); TRY(Core::System::pledge("stdio rpath"));
String program_name = AK::LexicalPath::basename(args.strings[0]); String program_name = AK::LexicalPath::basename(args.strings[0]);

View file

@ -33,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil("/etc/passwd", "r")); TRY(Core::System::unveil("/etc/passwd", "r"));
TRY(Core::System::unveil("/etc/group", "r")); TRY(Core::System::unveil("/etc/group", "r"));
TRY(Core::System::unveil(nullptr, nullptr)); TRY(Core::System::unveil(nullptr, nullptr));
TRY(Core::System::pledge("stdio rpath", nullptr)); TRY(Core::System::pledge("stdio rpath"));
Vector<char const*> usernames; Vector<char const*> usernames;

View file

@ -18,7 +18,7 @@ int head(String const& filename, bool print_filename, ssize_t line_count, ssize_
ErrorOr<int> serenity_main(Main::Arguments args) ErrorOr<int> serenity_main(Main::Arguments args)
{ {
TRY(Core::System::pledge("stdio rpath", nullptr)); TRY(Core::System::pledge("stdio rpath"));
int line_count = -1; int line_count = -1;
int byte_count = -1; int byte_count = -1;

View file

@ -14,7 +14,7 @@
ErrorOr<int> serenity_main(Main::Arguments args) ErrorOr<int> serenity_main(Main::Arguments args)
{ {
TRY(Core::System::pledge("stdio unix", nullptr)); TRY(Core::System::pledge("stdio unix"));
char const* name_or_ip = nullptr; char const* name_or_ip = nullptr;
Core::ArgsParser args_parser; Core::ArgsParser args_parser;

View file

@ -524,7 +524,7 @@ static void cat_file(FILE* file)
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
TRY(Core::System::pledge("stdio rpath tty sigaction", nullptr)); TRY(Core::System::pledge("stdio rpath tty sigaction"));
char const* filename = "-"; char const* filename = "-";
char const* prompt = "?f%f :.(line %l)?e (END):."; char const* prompt = "?f%f :.(line %l)?e (END):.";
@ -557,7 +557,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
g_resized = true; g_resized = true;
}); });
TRY(Core::System::pledge("stdio tty", nullptr)); TRY(Core::System::pledge("stdio tty"));
if (emulate_more) { if (emulate_more) {
// Configure options that match more's behavior // Configure options that match more's behavior

View file

@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
sa.sa_handler = handle_sigint; sa.sa_handler = handle_sigint;
sigaction(SIGINT, &sa, nullptr); sigaction(SIGINT, &sa, nullptr);
TRY(Core::System::pledge("stdio sigaction", nullptr)); TRY(Core::System::pledge("stdio sigaction"));
double whole_seconds = static_cast<time_t>(secs); double whole_seconds = static_cast<time_t>(secs);
double fraction = secs - whole_seconds; double fraction = secs - whole_seconds;

View file

@ -88,7 +88,7 @@ static ErrorOr<int> stat(StringView file, bool should_follow_links)
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
TRY(Core::System::pledge("stdio rpath", nullptr)); TRY(Core::System::pledge("stdio rpath"));
bool should_follow_links = false; bool should_follow_links = false;
Vector<StringView> files; Vector<StringView> files;

View file

@ -110,7 +110,7 @@ static int run_command(Vector<char const*> const& command)
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
TRY(Core::System::signal(SIGINT, handle_signal)); TRY(Core::System::signal(SIGINT, handle_signal));
TRY(Core::System::pledge("stdio proc exec rpath", nullptr)); TRY(Core::System::pledge("stdio proc exec rpath"));
Vector<String> files_to_watch; Vector<String> files_to_watch;
Vector<char const*> command; Vector<char const*> command;
@ -184,7 +184,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
} }
} }
} else { } else {
TRY(Core::System::pledge("stdio proc exec", nullptr)); TRY(Core::System::pledge("stdio proc exec"));
struct timeval interval; struct timeval interval;
if (opt_interval <= 0) { if (opt_interval <= 0) {

View file

@ -40,7 +40,7 @@ private:
ErrorOr<int> serenity_main(Main::Arguments main_arguments) ErrorOr<int> serenity_main(Main::Arguments main_arguments)
{ {
TRY(Core::System::pledge("stdio rpath proc exec", nullptr)); TRY(Core::System::pledge("stdio rpath proc exec"));
char const* placeholder = nullptr; char const* placeholder = nullptr;
bool split_with_nulls = false; bool split_with_nulls = false;