From 5232101487993f5fd9d2d6627e13e38ffe61e5a2 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Tue, 12 Oct 2010 15:14:10 +0800 Subject: [PATCH] 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 --- tools/virsh.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/virsh.c b/tools/virsh.c index 4101161ed..493d096dc 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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; -- 2.39.5