diff options
author | William A. Kennington III <wak@google.com> | 2018-09-13 18:35:56 -0700 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2018-09-17 10:38:36 -0700 |
commit | c2c26cebc273398116bc011b26a261e179db18b7 (patch) | |
tree | 1d64979a75fb661d238c809031c701235971ed00 | |
parent | 3bb2f4006f3c62a415e7610926b06fed7a045906 (diff) | |
download | phosphor-watchdog-c2c26cebc273398116bc011b26a261e179db18b7.tar.gz phosphor-watchdog-c2c26cebc273398116bc011b26a261e179db18b7.zip |
mainapp: Detect duplicate action targets
Tested:
Passes the unit test suite and manually verified that the daemon
works with a normal config on a zaius machine. Also verified that it
produces an error if configured with multiple targets for a single
action.
Change-Id: I8fba74f5fdfeb22c465e27b478805dc1ca702cd3
Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r-- | mainapp.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mainapp.cpp b/mainapp.cpp index c61fa85..29cd7e2 100644 --- a/mainapp.cpp +++ b/mainapp.cpp @@ -131,6 +131,12 @@ int main(int argc, char* argv[]) exitWithError("Bad action specified.", argv); } + // Detect duplicate action target arguments + if (actionTargetMap.find(action) != actionTargetMap.end()) + { + exitWithError("Duplicate action specified", argv); + } + actionTargetMap[action] = std::move(value); } printActionTargetMap(actionTargetMap); |