]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix longest match search in find_cli.
authorLuigi Rizzo <rizzo@icir.org>
Wed, 15 Nov 2006 17:46:45 +0000 (17:46 +0000)
committerLuigi Rizzo <rizzo@icir.org>
Wed, 15 Nov 2006 17:46:45 +0000 (17:46 +0000)
Trunk already fixed.

1.2 not affected (well, i have no idea, the code is totally
different there).

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@47672 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/cli.c

index b9afbd89bebf9714fe711e58cd5b2fcc9fef7c87..3d529cb86fed609a8b65827971c9c76c8257e4b8 100644 (file)
@@ -1378,8 +1378,10 @@ static struct ast_cli_entry *find_cli(char *const cmds[], int match_type)
                                continue;
                        /* we are in case match_type == -1 and mismatch on last word */
                }
-               if (cand == NULL || y > matchlen)       /* remember the candidate */
+               if (y > matchlen) {     /* remember the candidate */
+                       matchlen = y;
                        cand = e;
+               }
        }
        return e ? e : cand;
 }