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: Ie529b9a8261f651c76d2fc232d89d4f711cb05b5
Signed-off-by: PavanKumarIntel <pavanx.kumar.martha@intel.com>
diff --git a/callback-manager/src/callback_manager.cpp b/callback-manager/src/callback_manager.cpp
index d6a5dee..aaa5ffc 100644
--- a/callback-manager/src/callback_manager.cpp
+++ b/callback-manager/src/callback_manager.cpp
@@ -108,6 +108,7 @@
ledsToSet.push_back(std::make_pair(okLedPath, false));
for (const auto& ledPair : ledsToSet)
{
+ std::ios_base::fmtflags originalFlags = std::cerr.flags();
conn->async_method_call(
[ledPair](const boost::system::error_code ec) {
if (ec)
@@ -115,12 +116,14 @@
std::cerr << "Cannot set " << ledPair.first << " to "
<< std::boolalpha
<< std::get<bool>(ledPair.second) << "\n";
+ std::cerr.flags(originalFlags);
}
if constexpr (debug)
{
std::cerr << "Set " << ledPair.first << " to "
<< std::boolalpha
<< std::get<bool>(ledPair.second) << "\n";
+ std::cerr.flags(originalFlags);
}
},
ledManagerBusname, ledPair.first,