bsdtar: apply passphrase to appended archive reader

When creating an archive from an @archive argument, configure the
input reader rather than passing the output writer to
archive_read_add_passphrase(). Use the reader for error reporting as
well.
This commit is contained in:
Peiwei Hu committed 2026-08-03 08:49:58 +08:00
1 parent 7bd12a903f
commit 337e5fcd0c
1 file changed
+2 -2
+2 -2
View File
@@ -672,12 +672,12 @@ append_archive_filename(struct bsdtar *bsdtar, struct archive *a,
set_reader_options(bsdtar, ina);
archive_read_set_options(ina, "mtree:checkfs");
if (bsdtar->passphrase != NULL)
rc = archive_read_add_passphrase(a, bsdtar->passphrase);
rc = archive_read_add_passphrase(ina, bsdtar->passphrase);
else
rc = archive_read_set_passphrase_callback(ina, bsdtar,
&passphrase_callback);
if (rc != ARCHIVE_OK)
lafe_errc(1, 0, "%s", archive_error_string(a));
lafe_errc(1, 0, "%s", archive_error_string(ina));
if (archive_read_open_filename(ina, filename,
bsdtar->bytes_per_block)) {
lafe_warnc(0, "%s", archive_error_string(ina));