Fix the bugs found in static analysis
Not restoring ostream format
cerr format not restoring to default, can lead to printing
values in incorrect format.
Change-Id: Ic5b681bad30b2a8eb5bfd3b7adbf2a3be8176dce
Signed-off-by: PavanKumarIntel <pavanx.kumar.martha@intel.com>
diff --git a/include/host_error_monitor.hpp b/include/host_error_monitor.hpp
index 25ff550..0710ff2 100644
--- a/include/host_error_monitor.hpp
+++ b/include/host_error_monitor.hpp
@@ -146,9 +146,11 @@
static void printPECIError(const std::string& reg, const size_t addr,
const EPECIStatus peciStatus, const size_t cc)
{
+ std::ios_base::fmtflags originalFlags = std::cerr.flags();
std::cerr << "Failed to read " << reg << " on CPU address " << std::dec
<< addr << ". Error: " << peciStatus << ": cc: 0x" << std::hex
<< cc << "\n";
+ std::cerr.flags(originalFlags);
}
#endif