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>
diff --git a/mainapp.cpp b/mainapp.cpp
index c61fa85..29cd7e2 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -131,6 +131,12 @@
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);