cmdline: fix parsing
authorWenzhuo Lu <wenzhuo.lu@intel.com>
Tue, 25 Apr 2017 03:11:25 +0000 (11:11 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 30 Apr 2017 22:16:36 +0000 (00:16 +0200)
commit9b3fbb051d2e98161b68c8f5c60331170be7b853
tree30706fa548de3799c90395a483fda410f85b45c1
parentf5b4a9aa02dd39de1aa7f213d2bec61f2c7b1aee
cmdline: fix parsing

When parsing a CLI, all the CLI instances are checked
one by one. Even if an instance already matches the CLI,
the parsing will not stop for ambiguous check.
The problem is that the following check may change the
parsing result of the previous one even if the following
instance doesn't match.

Use a temporary validate for the parsing result when
trying to match an instance and only store the result
when it matches, so the previous result has no chance
to be changed.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
lib/librte_cmdline/cmdline_parse.c