aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-31 12:40:37 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-31 12:40:37 +0000
commit30a3e686b380a908a184c4c2fc7820e63f32e6e8 (patch)
tree2340efd8d3e1ace378bddf262745aea1b6725ad7
parent909c8d666c47890f2f8063db0ccdb55fffca5458 (diff)
downloadpaludis-30a3e686b380a908a184c4c2fc7820e63f32e6e8.tar.gz
paludis-30a3e686b380a908a184c4c2fc7820e63f32e6e8.tar.xz
Report libarchive errors more verbosely
-rw-r--r--paludis/repositories/e/ebuild/utils/unpaxinate.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/paludis/repositories/e/ebuild/utils/unpaxinate.cc b/paludis/repositories/e/ebuild/utils/unpaxinate.cc
index 4bd9544..6da1a95 100644
--- a/paludis/repositories/e/ebuild/utils/unpaxinate.cc
+++ b/paludis/repositories/e/ebuild/utils/unpaxinate.cc
@@ -32,9 +32,12 @@ int main(int argc, char *argv[])
archive_read_support_compression_all(archive);
archive_read_support_format_all(archive);
- if (ARCHIVE_OK != archive_read_open_filename(archive, archive_file.c_str(), 10240))
+ int x;
+
+ if (ARCHIVE_OK != ((x = archive_read_open_filename(archive, archive_file.c_str(), 10240))))
{
- std::cerr << "Could not open '" << archive_file << "'" << std::endl;
+ std::cerr << "Could not open '" << archive_file << "': libarchive returned " <<
+ x << ", archive_errno " << archive_errno(archive) << ": " << archive_error_string(archive) << std::endl;
return EXIT_FAILURE;
}
@@ -56,18 +59,20 @@ int main(int argc, char *argv[])
std::cout << out_filename << std::endl;
archive_entry_set_pathname(entry, out_filename.c_str());
- if (ARCHIVE_OK != archive_read_extract(archive, entry, ARCHIVE_EXTRACT_OWNER |
- ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_ACL |
- ARCHIVE_EXTRACT_FFLAGS | ARCHIVE_EXTRACT_XATTR | ARCHIVE_EXTRACT_SECURE_NODOTDOT))
+ if (ARCHIVE_OK != ((x = archive_read_extract(archive, entry, ARCHIVE_EXTRACT_OWNER |
+ ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_ACL |
+ ARCHIVE_EXTRACT_FFLAGS | ARCHIVE_EXTRACT_XATTR | ARCHIVE_EXTRACT_SECURE_NODOTDOT))))
{
- std::cerr << "Could not extract '" << out_filename << "' from '" << archive_file << "'" << std::endl;
+ std::cerr << "Could not extract '" << out_filename << "' from '" << archive_file << "': libarchive returned " <<
+ x << ", archive_errno " << archive_errno(archive) << ": " << archive_error_string(archive) << std::endl;
return EXIT_FAILURE;
}
}
- if (ARCHIVE_OK != archive_read_finish(archive))
+ if (ARCHIVE_OK != ((x = archive_read_finish(archive))))
{
- std::cerr << "Could not finish reading '" << archive_file << "'" << std::endl;
+ std::cerr << "Could not finish reading '" << archive_file << "': libarchive returned " <<
+ x << ", archive_errno " << archive_errno(archive) << ": " << archive_error_string(archive) << std::endl;
return EXIT_FAILURE;
}