diff options
author | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2014-10-04 15:55:34 +0900 |
---|---|---|
committer | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2014-10-04 19:33:46 +0900 |
commit | b5af190b7eb85efebcd06c971fa03549436572f2 (patch) | |
tree | bbd5e0e965a1ab32e2676a335f302d6506051dc3 /tar/read.c | |
parent | c1732828cd802c26e18891c4c95f49c15819c985 (diff) | |
download | libarchive-b5af190b7eb85efebcd06c971fa03549436572f2.tar.gz |
Do not ask passphrases when a passphrase was already specified with
--passphrase option.
Diffstat (limited to 'tar/read.c')
-rw-r--r-- | tar/read.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -205,12 +205,13 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (archive_read_set_options(a, "read_concatenated_archives") != ARCHIVE_OK) lafe_errc(1, 0, "%s", archive_error_string(a)); - if (bsdtar->passphrase != NULL) { - if (archive_read_add_passphrase(a, - bsdtar->passphrase) != ARCHIVE_OK) - lafe_errc(1, 0, "%s", archive_error_string(a)); - } - archive_read_set_passphrase_callback(a, bsdtar, &passphrase_callback); + if (bsdtar->passphrase != NULL) + r = archive_read_add_passphrase(a, bsdtar->passphrase); + else + r = archive_read_set_passphrase_callback(a, bsdtar, + &passphrase_callback); + if (r != ARCHIVE_OK) + lafe_errc(1, 0, "%s", archive_error_string(a)); if (archive_read_open_filename(a, bsdtar->filename, bsdtar->bytes_per_block)) lafe_errc(1, 0, "Error opening archive: %s", |