mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
Utilities/tar: Open archive file before changing directory
Otherwise the utility will fail to open the archive file because it's presumably not in the chosen directory.
This commit is contained in:
parent
d906255cbb
commit
a7aa843bcc
Notes:
sideshowbarker
2024-07-18 08:59:31 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/a7aa843bcc Pull-request: https://github.com/SerenityOS/serenity/pull/24507 Reviewed-by: https://github.com/timschumi ✅
@ -72,11 +72,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
}
|
||||
|
||||
if (list || extract) {
|
||||
NonnullOwnPtr<Stream> input_stream = TRY(Core::InputBufferedFile::create(TRY(Core::File::open_file_or_standard_stream(archive_file, Core::File::OpenMode::Read))));
|
||||
|
||||
if (!directory.is_empty())
|
||||
TRY(Core::System::chdir(directory));
|
||||
|
||||
NonnullOwnPtr<Stream> input_stream = TRY(Core::InputBufferedFile::create(TRY(Core::File::open_file_or_standard_stream(archive_file, Core::File::OpenMode::Read))));
|
||||
|
||||
if (gzip)
|
||||
input_stream = make<Compress::GzipDecompressor>(move(input_stream));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user