aboutsummaryrefslogtreecommitdiffstats
path: root/ponymix.cc
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-03-12 12:48:32 -0400
committerDave Reisner <dreisner@archlinux.org>2013-03-12 12:48:32 -0400
commitaf38a7762b23a950618801ca8d8bbfec87bb02a7 (patch)
treeb3c40ba3f1a04d29e539d96ae0fc629e93f1f50d /ponymix.cc
parent6903b4975e38e29008e21222a7323d3920b804e8 (diff)
downloadmirror-ponymix-af38a7762b23a950618801ca8d8bbfec87bb02a7.tar.gz
mirror-ponymix-af38a7762b23a950618801ca8d8bbfec87bb02a7.tar.bz2
mirror-ponymix-af38a7762b23a950618801ca8d8bbfec87bb02a7.zip
check for exact match before matching on a prefix
Diffstat (limited to 'ponymix.cc')
-rw-r--r--ponymix.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/ponymix.cc b/ponymix.cc
index b3c1b98..8ad23ed 100644
--- a/ponymix.cc
+++ b/ponymix.cc
@@ -449,8 +449,14 @@ static const std::pair<const string, const Command>& string_to_command(
};
const auto match = actionmap.lower_bound(str);
+
+ // Check for exact match
+ if (match->first == str) {
+ return *match;
+ }
+
+ // Match on prefix, ensure only a single match
for (auto iter = match; iter != actionmap.end(); iter++) {
- // Match on prefix, ensure only a single match
if (iter->first.find(str) != 0) {
if (iter == match) {
errx(1, "error: Invalid action specified: %s", str);