--passphrase option.
cpio->linkresolver = archive_entry_linkresolver_new();
archive_entry_linkresolver_set_strategy(cpio->linkresolver,
archive_format(cpio->archive));
- if (cpio->passphrase != NULL) {
- if (archive_write_set_passphrase(cpio->archive,
- cpio->passphrase) != ARCHIVE_OK)
- lafe_errc(1, 0, "%s",
- archive_error_string(cpio->archive));
- }
- archive_write_set_passphrase_callback(cpio->archive, cpio,
- &passphrase_callback);
+ if (cpio->passphrase != NULL)
+ r = archive_write_set_passphrase(cpio->archive,
+ cpio->passphrase);
+ else
+ r = archive_write_set_passphrase_callback(cpio->archive, cpio,
+ &passphrase_callback);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
/*
* The main loop: Copy each file into the output archive.
lafe_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
- if (cpio->passphrase != NULL) {
- if (archive_read_add_passphrase(a,
- cpio->passphrase) != ARCHIVE_OK)
- lafe_errc(1, 0, "%s", archive_error_string(a));
- }
- archive_read_set_passphrase_callback(a, cpio, &passphrase_callback);
+ if (cpio->passphrase != NULL)
+ r = archive_read_add_passphrase(a, cpio->passphrase);
+ else
+ r = archive_read_set_passphrase_callback(a, cpio,
+ &passphrase_callback);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
if (archive_read_open_filename(a, cpio->filename,
cpio->bytes_per_block))
lafe_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
- if (cpio->passphrase != NULL) {
- if (archive_read_add_passphrase(a,
- cpio->passphrase) != ARCHIVE_OK)
- lafe_errc(1, 0, "%s", archive_error_string(a));
- }
- archive_read_set_passphrase_callback(a, cpio, &passphrase_callback);
+ if (cpio->passphrase != NULL)
+ r = archive_read_add_passphrase(a, cpio->passphrase);
+ else
+ r = archive_read_set_passphrase_callback(a, cpio,
+ &passphrase_callback);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
if (archive_read_open_filename(a, cpio->filename,
cpio->bytes_per_block))
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",
}
set_writer_options(bsdtar, a);
- if (bsdtar->passphrase != NULL) {
- if (archive_write_set_passphrase(a,
- bsdtar->passphrase) != ARCHIVE_OK)
- lafe_errc(1, 0, "%s", archive_error_string(a));
- }
- archive_write_set_passphrase_callback(a, bsdtar, &passphrase_callback);
+ if (bsdtar->passphrase != NULL)
+ r = archive_write_set_passphrase(a, bsdtar->passphrase);
+ else
+ r = archive_write_set_passphrase_callback(a, bsdtar,
+ &passphrase_callback);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
if (ARCHIVE_OK != archive_write_open_filename(a, bsdtar->filename))
lafe_errc(1, 0, "%s", archive_error_string(a));
write_archive(a, bsdtar);
archive_read_support_filter_all(ina);
set_reader_options(bsdtar, ina);
archive_read_set_options(ina, "mtree:checkfs");
- 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(ina, bsdtar, &passphrase_callback);
+ if (bsdtar->passphrase != NULL)
+ rc = archive_read_add_passphrase(a, 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));
if (archive_read_open_filename(ina, filename,
bsdtar->bytes_per_block)) {
lafe_warnc(0, "%s", archive_error_string(ina));