mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
virsh: add escaper \ for command string parsing
add escaper \ for command string parsing, example: virsh # cd /path/which/have/a/double\"quote Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
This commit is contained in:
parent
2f72becc31
commit
5232101487
@ -10406,7 +10406,13 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandParser *parser, char **res)
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user