add escaper \ for command string parsing, example:
virsh # cd /path/which/have/a/double\"quote
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
if (!double_quote && (*p == ' ' || *p == '\t' || *p == ';'))
break;
- if (*p == '"') {
+ if (*p == '\\') { /* escape */
+ p++;
+ if (*p == '\0') {
+ vshError(ctl, "%s", _("dangling \\"));
+ return VSH_TK_ERROR;
+ }
+ } else if (*p == '"') { /* double quote */
double_quote = !double_quote;
p++;
continue;