summaryrefslogtreecommitdiff
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-02-25 11:28:07 -0500
committerBrad King <brad.king@kitware.com>2016-02-25 11:40:50 -0500
commit6c9586f9c7804c4560a43aa6a03e490374174550 (patch)
treea58deccca02a19cdc8a21aefabea345e69c03b71 /Source/cmFileCommand.cxx
parentf8af218ea148baafcfc3db6ea5ba7389f5ea7206 (diff)
downloadcmake-6c9586f9c7804c4560a43aa6a03e490374174550.tar.gz
file(DOWNLOAD): Fill STATUS variable on hash mismatch (#15987)
Although we fail with an error on a hash mismatch, it is not a fatal error so the script may continue processing. If the download itself had no error then report in the STATUS variable that the operation was not successful due to the hash mismatch. Suggested-by: Tobias Hieta <tobias@hieta.se>
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index b3557f9a29..1fa27eb47c 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3300,6 +3300,15 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
<< " status: [" << (int)res << ";\""
<< ::curl_easy_strerror(res) << "\"]" << std::endl
;
+
+ if(!statusVar.empty() && res == 0)
+ {
+ std::string status = "1;HASH mismatch: "
+ "expected: " + expectedHash +
+ " actual: " + actualHash;
+ this->Makefile->AddDefinition(statusVar, status.c_str());
+ }
+
this->SetError(oss.str());
return false;
}