提交 52321014 编写于 作者: L Lai Jiangshan 提交者: Eric Blake

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: NLai Jiangshan <laijs@cn.fujitsu.com>
上级 2f72becc
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册