mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 20:44:20 +00:00
Fix a segfault when trying to tab complete the "core show uptime" command.
Reported in #asterisk-dev on IRC by jcmoore, fixed by me. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@72326 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -387,7 +387,7 @@ static char * handle_showuptime(struct ast_cli_entry *e, int cmd, struct ast_cli
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CLI_INIT:
|
case CLI_INIT:
|
||||||
e->command = "core show uptime";
|
e->command = "core show uptime [seconds]";
|
||||||
e->usage =
|
e->usage =
|
||||||
"Usage: core show uptime [seconds]\n"
|
"Usage: core show uptime [seconds]\n"
|
||||||
" Shows Asterisk uptime information.\n"
|
" Shows Asterisk uptime information.\n"
|
||||||
@@ -395,12 +395,12 @@ static char * handle_showuptime(struct ast_cli_entry *e, int cmd, struct ast_cli
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
case CLI_GENERATE:
|
case CLI_GENERATE:
|
||||||
return (a->pos > e->args || a->n > 0) ? NULL : "seconds";
|
return NULL;
|
||||||
}
|
}
|
||||||
/* regular handler */
|
/* regular handler */
|
||||||
if (a->argc == e->args+1 && !strcasecmp(a->argv[e->args],"seconds"))
|
if (a->argc == e->args && !strcasecmp(a->argv[e->args-1],"seconds"))
|
||||||
printsec = 1;
|
printsec = 1;
|
||||||
else if (a->argc == e->args)
|
else if (a->argc == e->args-1)
|
||||||
printsec = 0;
|
printsec = 0;
|
||||||
else
|
else
|
||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
|
Reference in New Issue
Block a user