mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
sed: Correctly unveil all paths
- The veil was never closed. - unveil() only works with absolute paths. - Files from the regular input list weren't unveiled.
This commit is contained in:
parent
95c571ca53
commit
34f8147385
Notes:
sideshowbarker
2024-07-16 20:41:14 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/34f8147385 Pull-request: https://github.com/SerenityOS/serenity/pull/17759 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/gmta
1 changed files with 5 additions and 2 deletions
|
@ -877,10 +877,10 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
}
|
||||
|
||||
for (auto const& input_filename : TRY(script.input_filenames())) {
|
||||
TRY(Core::System::unveil(input_filename, "r"sv));
|
||||
TRY(Core::System::unveil(TRY(FileSystem::absolute_path(input_filename)), "r"sv));
|
||||
}
|
||||
for (auto const& output_filename : TRY(script.output_filenames())) {
|
||||
TRY(Core::System::unveil(output_filename, "w"sv));
|
||||
TRY(Core::System::unveil(TRY(FileSystem::absolute_path(output_filename)), "w"sv));
|
||||
}
|
||||
|
||||
Vector<InputFile> inputs;
|
||||
|
@ -888,10 +888,13 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
if (filename == "-"sv) {
|
||||
inputs.empend(TRY(InputFile::create_from_stdin()));
|
||||
} else {
|
||||
TRY(Core::System::unveil(TRY(FileSystem::absolute_path(filename)), edit_in_place ? "rwc"sv : "r"sv));
|
||||
auto file = TRY(Core::File::open(filename, Core::File::OpenMode::Read));
|
||||
inputs.empend(TRY(InputFile::create(move(file))));
|
||||
}
|
||||
}
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
if (inputs.is_empty()) {
|
||||
inputs.empend(TRY(InputFile::create_from_stdin()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue