mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
Properly handle the case where read() may return the text for more than one
CLI command at once for a remote console. (closes issue #10888) Reported by: jamesgolovich Patches: asterisk-climultiple.diff.txt uploaded by jamesgolovich (license 176) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@85532 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
17
main/cli.c
17
main/cli.c
@@ -2005,3 +2005,20 @@ int ast_cli_command(int fd, const char *s)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_cli_command_multiple(int fd, size_t size, const char *s)
|
||||
{
|
||||
char cmd[512];
|
||||
int x, y = 0, count = 0;
|
||||
|
||||
for (x = 0; x < size; x++) {
|
||||
cmd[y] = s[x];
|
||||
y++;
|
||||
if (s[x] == '\0') {
|
||||
ast_cli_command(fd, cmd);
|
||||
y = 0;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
Reference in New Issue
Block a user