mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 11:42:27 +00:00
make kevin (and 64 bit machines) happy and
remove a cast from char* to int in handling the return values from new-style handlers. On passing, note that main/loader.c::ast_load_resource() always return 0 so errors are not propagated up. I am not sure this is the intended behaviour. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
12
main/cli.c
12
main/cli.c
@@ -1649,9 +1649,16 @@ int ast_cli_command(int fd, const char *s)
|
|||||||
*/
|
*/
|
||||||
args[0] = (char *)e;
|
args[0] = (char *)e;
|
||||||
if (e->new_handler) { /* new style */
|
if (e->new_handler) { /* new style */
|
||||||
|
char *retval;
|
||||||
struct ast_cli_args a = {
|
struct ast_cli_args a = {
|
||||||
.fd = fd, .argc = x, .argv = args+1 };
|
.fd = fd, .argc = x, .argv = args+1 };
|
||||||
res = (int)e->new_handler(e, CLI_HANDLER, &a);
|
retval = e->new_handler(e, CLI_HANDLER, &a);
|
||||||
|
if (retval == CLI_SUCCESS)
|
||||||
|
res = RESULT_SUCCESS;
|
||||||
|
else if (retval == CLI_SHOWUSAGE)
|
||||||
|
res = RESULT_SHOWUSAGE;
|
||||||
|
else
|
||||||
|
res = RESULT_FAILURE;
|
||||||
} else { /* old style */
|
} else { /* old style */
|
||||||
res = e->handler(fd, x, args + 1);
|
res = e->handler(fd, x, args + 1);
|
||||||
}
|
}
|
||||||
@@ -1662,6 +1669,9 @@ int ast_cli_command(int fd, const char *s)
|
|||||||
else
|
else
|
||||||
ast_cli(fd, "Invalid usage, but no usage information available.\n");
|
ast_cli(fd, "Invalid usage, but no usage information available.\n");
|
||||||
break;
|
break;
|
||||||
|
case RESULT_FAILURE:
|
||||||
|
ast_cli(fd, "Command '%s' failed.\n", s);
|
||||||
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
AST_LIST_LOCK(&helpers);
|
AST_LIST_LOCK(&helpers);
|
||||||
if (e->deprecated == 1) {
|
if (e->deprecated == 1) {
|
||||||
|
Reference in New Issue
Block a user