fix: cmd start with \n will terminate the server
This commit is contained in:
parent
bcabef7925
commit
f5e321c443
|
@ -91,12 +91,12 @@ int pbx_get_next_command(FILE* f, char** str) {
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd[index++] = c;
|
||||||
|
if (c == '\r' || c == '\n')
|
||||||
|
cmd[index-1] = '\0';
|
||||||
|
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
break;
|
break;
|
||||||
if (c == '\r')
|
|
||||||
c = '\0';
|
|
||||||
|
|
||||||
cmd[index++] = c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// command is empty
|
// command is empty
|
||||||
|
|
Loading…
Reference in New Issue
Block a user