From 6df2e44404bd710b13539a09450117f755498c65 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 11 Jun 2019 21:19:46 +0200 Subject: vty: command.c: Fix is_cmd_ambiguous() returning always 0 inner block defined variable "enum match_type ret" was being masking outter block variable "int ret = 0". The ret variable was being given non zero values only inside the inner block, so that change was done on the inner variable and not the outer one, which is returned. Fixes: 5314c513f23688462d7f7937e5ae5e0d5cd4548e Change-Id: Iec87d7db49a096d07e38ff8a060b923a52bfd6ba --- src/vty/command.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/vty') diff --git a/src/vty/command.c b/src/vty/command.c index 6380487e..e9690bbf 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -1521,7 +1521,7 @@ is_cmd_ambiguous(char *command, vector v, int index, enum match_type type) if (!desc) continue; - enum match_type ret; + enum match_type mtype; const char *str = desc->cmd; if (CMD_OPTION(str)) { @@ -1573,10 +1573,10 @@ is_cmd_ambiguous(char *command, vector v, int index, enum match_type type) match++; break; case ipv6_prefix_match: - if ((ret = + if ((mtype = cmd_ipv6_prefix_match (command)) != no_match) { - if (ret == partly_match) { + if (mtype == partly_match) { ret = 2; /* There is incomplete match. */ goto free_and_return; } @@ -1590,10 +1590,10 @@ is_cmd_ambiguous(char *command, vector v, int index, enum match_type type) match++; break; case ipv4_prefix_match: - if ((ret = + if ((mtype = cmd_ipv4_prefix_match (command)) != no_match) { - if (ret == partly_match) { + if (mtype == partly_match) { ret = 2; /* There is incomplete match. */ goto free_and_return; } -- cgit v1.2.3