summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx48
1 files changed, 33 insertions, 15 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 8339aac..568ee82 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1733,6 +1733,32 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
fflush(out);
}
+bool la_diagnostic(struct archive* ar, __LA_SSIZE_T r)
+{
+ // See archive.h definition of ARCHIVE_OK for return values.
+
+ if (r >= ARCHIVE_OK) {
+ return true;
+ }
+
+ if (r >= ARCHIVE_WARN) {
+ const char* warn = archive_error_string(ar);
+ if (!warn) {
+ warn = "unknown warning";
+ }
+ std::cerr << "cmake -E tar: warning: " << warn << '\n';
+ return true;
+ }
+
+ // Error.
+ const char* err = archive_error_string(ar);
+ if (!err) {
+ err = "unknown error";
+ }
+ std::cerr << "cmake -E tar: error: " << err << '\n';
+ return false;
+}
+
// Return 'true' on success
bool copy_data(struct archive* ar, struct archive* aw)
{
@@ -1746,24 +1772,17 @@ bool copy_data(struct archive* ar, struct archive* aw)
# endif
for (;;) {
- // Return value:
- // * ARCHIVE_OK - read succeed
- // * ARCHIVE_EOF - no more data to read left
+ // See archive.h definition of ARCHIVE_OK for return values.
r = archive_read_data_block(ar, &buff, &size, &offset);
if (r == ARCHIVE_EOF) {
return true;
}
- if (r != ARCHIVE_OK) {
+ if (!la_diagnostic(ar, r)) {
return false;
}
- // Return value:
- // * >= ARCHIVE_OK - write succeed
- // * < ARCHIVE_OK - write failed
- const __LA_SSIZE_T w_size =
- archive_write_data_block(aw, buff, size, offset);
- if (w_size < ARCHIVE_OK) {
- cmSystemTools::Message("archive_write_data_block()",
- archive_error_string(aw));
+ // See archive.h definition of ARCHIVE_OK for return values.
+ __LA_SSIZE_T const w = archive_write_data_block(aw, buff, size, offset);
+ if (!la_diagnostic(ar, w)) {
return false;
}
}
@@ -1822,7 +1841,6 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
r = archive_write_header(ext, entry);
if (r == ARCHIVE_OK) {
if (!copy_data(a, ext)) {
- cmSystemTools::Error("Problem with copy_data");
break;
}
r = archive_write_finish_entry(ext);
@@ -2826,11 +2844,11 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
// contain the location of the linker map, however on MIPS the
// .dynamic section is always read-only so this is not possible. MIPS
// objects instead contain a DT_MIPS_RLD_MAP tag which contains the
- // address where the dyanmic linker will write to (an indirect
+ // address where the dynamic linker will write to (an indirect
// version of DT_DEBUG). Since this doesn't work when using PIE, a
// relative equivalent was created - DT_MIPS_RLD_MAP_REL. Since this
// version contains a relative offset, moving it changes the
- // calculated address. This may cause the dyanmic linker to write
+ // calculated address. This may cause the dynamic linker to write
// into memory it should not be changing.
//
// To fix this, we adjust the value of DT_MIPS_RLD_MAP_REL here. If