[asterisk-commits] eliel: trunk r156355 - /trunk/res/res_clialiases.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 12 14:27:41 CST 2008


Author: eliel
Date: Wed Nov 12 14:27:40 2008
New Revision: 156355

URL: http://svn.digium.com/view/asterisk?view=rev&rev=156355
Log:
- Make alias->real_cmd point to the allocated space outside alias->alias.
- Register the aliased cli command (or we will not alias anything).
- Use ARRAY_LEN() when possible.

Modified:
    trunk/res/res_clialiases.c

Modified: trunk/res/res_clialiases.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_clialiases.c?view=diff&rev=156355&r1=156354&r2=156355
==============================================================================
--- trunk/res/res_clialiases.c (original)
+++ trunk/res/res_clialiases.c Wed Nov 12 14:27:40 2008
@@ -213,13 +213,14 @@
 				continue;
 			}
 			alias->alias = ((char *) alias) + sizeof(*alias);
-			alias->real_cmd = ((char *) alias) + strlen(v1->name) + 1;
+			alias->real_cmd = ((char *) alias->alias) + strlen(v1->name) + 1;
 			strcpy(alias->alias, v1->name);
 			strcpy(alias->real_cmd, v1->value);
 			alias->cli_entry.handler = cli_alias_passthrough;
 			alias->cli_entry.command = alias->alias;
 			alias->cli_entry.usage = "Aliased CLI Command";
 
+			ast_cli_register(&alias->cli_entry);
 			ao2_link(cli_aliases, alias);
 			ast_verbose(VERBOSE_PREFIX_2 "Aliased CLI command '%s' to '%s'\n", v1->name, v1->value);
 			ao2_ref(alias, -1);
@@ -262,7 +263,7 @@
 
 	load_config(0);
 
-	ast_cli_register_multiple(cli_alias, sizeof(cli_alias) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_alias, ARRAY_LEN(cli_alias));
 
 	return AST_MODULE_LOAD_SUCCESS;
 }




More information about the asterisk-commits mailing list