diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-12-02 03:45:18 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-12-02 03:58:05 (GMT) |
commit | a820877d033069062f2cac83d9e611d5af905d0a (patch) | |
tree | c82f66e8e3ff1d11f5a996c7a0dd51e362588e43 /Source/cmake.cxx | |
parent | 5cf7018af6a5f5f0c84c9b7d5b31d9f849503886 (diff) | |
download | CMake-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/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 942c59b..f54196b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1707,10 +1707,8 @@ void cmake::SetTraceFile(const std::string& file) this->TraceFile.close(); this->TraceFile.open(file.c_str()); if (!this->TraceFile) { - std::stringstream ss; - ss << "Error opening trace file " << file << ": " - << cmSystemTools::GetLastSystemError(); - cmSystemTools::Error(ss.str()); + cmSystemTools::Error(cmStrCat("Error opening trace file ", file, ": ", + cmSystemTools::GetLastSystemError())); return; } std::cout << "Trace will be written to " << file << '\n'; |