summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCopier.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-12-02 03:45:18 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-12-02 03:58:05 (GMT)
commita820877d033069062f2cac83d9e611d5af905d0a (patch)
treec82f66e8e3ff1d11f5a996c7a0dd51e362588e43 /Source/cmFileCopier.cxx
parent5cf7018af6a5f5f0c84c9b7d5b31d9f849503886 (diff)
downloadCMake-a820877d033069062f2cac83d9e611d5af905d0a.zip
CMake-a820877d033069062f2cac83d9e611d5af905d0a.tar.gz
CMake-a820877d033069062f2cac83d9e611d5af905d0a.tar.bz2
errors: avoid constructing a stream before getting the last error
Constructing a stream may involve operations that change the global error state. Avoid the streams by using `cmStrCat` instead.
Diffstat (limited to 'Source/cmFileCopier.cxx')
-rw-r--r--Source/cmFileCopier.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx
index d6e91fa..686162b 100644
--- a/Source/cmFileCopier.cxx
+++ b/Source/cmFileCopier.cxx
@@ -119,10 +119,9 @@ std::string const& cmFileCopier::ToName(std::string const& fromName)
bool cmFileCopier::ReportMissing(const std::string& fromFile)
{
// The input file does not exist and installation is not optional.
- std::ostringstream e;
- e << this->Name << " cannot find \"" << fromFile
- << "\": " << cmSystemTools::GetLastSystemError() << ".";
- this->Status.SetError(e.str());
+ this->Status.SetError(cmStrCat(this->Name, " cannot find \"", fromFile,
+ "\": ", cmSystemTools::GetLastSystemError(),
+ '.'));
return false;
}