Fix klocwork issues
Klockwork reports these issues:
1. phosphor-watchdog/src/mainapp.cpp:119 | main()
'fallbackAlways' is used uninitialized in this function.
2. phosphor-watchdog/src/mainapp.cpp:129 | main()
'watchPostcodes' is used uninitialized in this function.
3. phosphor-watchdog/src/mainapp.cpp:80 | main()
'continueAfterTimeout' is used uninitialized in this function.
This commit adds default values to resolve these issues.
Tested: Watchdog service worked well.
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Change-Id: Ib88afb60e801c3f90e039cca99dca5409e896fc1
diff --git a/src/mainapp.cpp b/src/mainapp.cpp
index 063b8d3..1654eca 100644
--- a/src/mainapp.cpp
+++ b/src/mainapp.cpp
@@ -76,7 +76,7 @@
"Ex: xyz.openbmc_project.State.Watchdog.Host")
->required()
->group(serviceGroup);
- bool continueAfterTimeout;
+ bool continueAfterTimeout{false};
app.add_flag("-c,--continue", continueAfterTimeout,
"Continue daemon after watchdog timeout")
->group(serviceGroup);
@@ -115,7 +115,7 @@
->group(fallbackGroup);
fallbackIntervalOpt->needs(fallbackActionOpt);
fallbackActionOpt->needs(fallbackIntervalOpt);
- bool fallbackAlways;
+ bool fallbackAlways{false};
app.add_flag("-e,--fallback_always", fallbackAlways,
"Enables the "
"watchdog even when disabled by the dbus interface. "
@@ -125,7 +125,7 @@
->needs(fallbackIntervalOpt);
// Should we watch for postcodes
- bool watchPostcodes;
+ bool watchPostcodes{false};
app.add_flag("-w,--watch_postcodes", watchPostcodes,
"Should we reset the time remaining any time a postcode "
"is signaled.");