summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-11-26 11:22:52 (GMT)
committerBrad King <brad.king@kitware.com>2012-11-26 16:54:38 (GMT)
commit37c34d7d7b7b32c0f6c00acbb3375c79e42a5587 (patch)
treeb3ab261707b403782abb910c4a7832478a86f988 /Source/cmSystemTools.cxx
parenta7742140ad1a88e354037ea391c0e773f147ebd2 (diff)
downloadCMake-37c34d7d7b7b32c0f6c00acbb3375c79e42a5587.zip
CMake-37c34d7d7b7b32c0f6c00acbb3375c79e42a5587.tar.gz
CMake-37c34d7d7b7b32c0f6c00acbb3375c79e42a5587.tar.bz2
CMake: Fix infinite loop untarring corrupt tar file
Suggested-by: Robert Maynard <robert.maynard@kitware.com>
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 89f03f6..544f7e4 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1932,6 +1932,7 @@ bool extract_tar(const char* outFileName, bool verbose,
{
cmSystemTools::Error("Problem with archive_read_next_header(): ",
archive_error_string(a));
+ break;
}
if (verbose && extract)
{
@@ -1954,6 +1955,7 @@ bool extract_tar(const char* outFileName, bool verbose,
cmSystemTools::Error(
"Problem with archive_write_disk_set_options(): ",
archive_error_string(ext));
+ break;
}
r = archive_write_header(ext, entry);
@@ -1963,6 +1965,7 @@ bool extract_tar(const char* outFileName, bool verbose,
archive_error_string(ext));
cmSystemTools::Error("Current file:",
archive_entry_pathname(entry));
+ break;
}
else
{
@@ -1972,6 +1975,7 @@ bool extract_tar(const char* outFileName, bool verbose,
{
cmSystemTools::Error("Problem with archive_write_finish_entry(): ",
archive_error_string(ext));
+ break;
}
}
}
@@ -1982,8 +1986,7 @@ bool extract_tar(const char* outFileName, bool verbose,
}
archive_read_close(a);
archive_read_finish(a);
- return true;
-
+ return r == ARCHIVE_EOF || r == ARCHIVE_OK;
}
}
#endif