[asterisk-commits] file: branch file/res_clialiases r144630 - /team/file/res_clialiases/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 26 11:28:26 CDT 2008


Author: file
Date: Fri Sep 26 11:28:26 2008
New Revision: 144630

URL: http://svn.digium.com/view/asterisk?view=rev&rev=144630
Log:
Handle the scenario where an alias may have already been registered, or it may conflict with an already existing CLI command.

Modified:
    team/file/res_clialiases/res/res_clialiases.c

Modified: team/file/res_clialiases/res/res_clialiases.c
URL: http://svn.digium.com/view/asterisk/team/file/res_clialiases/res/res_clialiases.c?view=diff&rev=144630&r1=144629&r2=144630
==============================================================================
--- team/file/res_clialiases/res/res_clialiases.c (original)
+++ team/file/res_clialiases/res/res_clialiases.c Fri Sep 26 11:28:26 2008
@@ -215,10 +215,13 @@
 		alias->cli_entry.handler = cli_alias_passthrough;
 		alias->cli_entry.command = alias->alias;
 		alias->cli_entry.usage = "Aliased CLI Command";
-		ao2_link(cli_aliases, alias);
-		ast_cli_register(&alias->cli_entry);
+		if (!ast_cli_register(&alias->cli_entry)) {
+			ao2_link(cli_aliases, alias);
+			ast_verbose(VERBOSE_PREFIX_2 "Aliased CLI command '%s' to '%s'\n", v->name, v->value);
+		} else {
+			ast_verbose(VERBOSE_PREFIX_2 "Failed to alias '%s' to '%s' as the CLI command already exists\n", v->name, v->value);
+		}
 		ao2_ref(alias, -1);
-		ast_verbose(VERBOSE_PREFIX_2 "Aliased CLI command '%s' to '%s'\n", v->name, v->value);
 	}
 
 	/* Drop any CLI aliases that should no longer exist */




More information about the asterisk-commits mailing list