From 3ff482130727e7da5f4d31d59c0cf648c3bb5515 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Wed, 28 Jan 2015 10:45:59 +0200 Subject: [PATCH] mon: fix Monitor::_get_moncommand() It should match command prefix, not any substring. Signed-off-by: Mykola Golub --- src/mon/Monitor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 6344b32b56c44..1d6030826b49c 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2430,7 +2430,7 @@ const MonCommand *Monitor::_get_moncommand(const string &cmd_prefix, MonCommand *this_cmd = NULL; for (MonCommand *cp = cmds; cp < &cmds[cmds_size]; cp++) { - if (cp->cmdstring.find(cmd_prefix) != string::npos) { + if (cp->cmdstring.compare(0, cmd_prefix.size(), cmd_prefix) == 0) { this_cmd = cp; break; } -- 2.39.5