Change in ...libosmocore[master]: vty: command.c: Fix is_cmd_ambiguous() returning always 0

pespin gerrit-no-reply at lists.osmocom.org
Tue Jun 11 19:21:30 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/14422


Change subject: vty: command.c: Fix is_cmd_ambiguous() returning always 0
......................................................................

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.

Change-Id: Iec87d7db49a096d07e38ff8a060b923a52bfd6ba
---
M src/vty/command.c
1 file changed, 5 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/22/14422/1

diff --git a/src/vty/command.c b/src/vty/command.c
index 6380487..e9690bb 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -1521,7 +1521,7 @@
 				if (!desc)
 					continue;
 
-				enum match_type ret;
+				enum match_type mtype;
 				const char *str = desc->cmd;
 
 				if (CMD_OPTION(str)) {
@@ -1573,10 +1573,10 @@
 						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 @@
 						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;
 						}

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14422
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iec87d7db49a096d07e38ff8a060b923a52bfd6ba
Gerrit-Change-Number: 14422
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190611/181128c7/attachment.html>


More information about the gerrit-log mailing list