mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
zip: Add unveil and pledge promises
This commit is contained in:
parent
9d7a862509
commit
2ed4e47300
1 changed files with 10 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/FileStream.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibCrypto/Checksum/CRC32.h>
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
|
@ -27,6 +28,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(force, "Overwrite existing zip file", "force", 'f');
|
||||
args_parser.parse(arguments);
|
||||
|
||||
TRY(Core::System::pledge("stdio rpath wpath cpath"));
|
||||
|
||||
auto cwd = TRY(Core::System::getcwd());
|
||||
TRY(Core::System::unveil(LexicalPath::absolute_path(cwd, zip_path), "wc"));
|
||||
for (auto const& source_path : source_paths) {
|
||||
TRY(Core::System::unveil(LexicalPath::absolute_path(cwd, source_path), "r"));
|
||||
}
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
String zip_file_path { zip_path };
|
||||
if (Core::File::exists(zip_file_path)) {
|
||||
if (force) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue