summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2016-04-22 18:27:44 -0400
committerCole Robinson <crobinso@redhat.com>2016-05-16 10:30:38 -0400
commit7dbbc0ca07f0e8f2f3652afe4a3f7d94940bef1e (patch)
tree8be946fd4b1f7edee26dfc4065a72a4a1f6b4065
parent077ba95677419fb9916a7ddb09c45d24aced5dcb (diff)
downloadlibvirt-7dbbc0ca07f0e8f2f3652afe4a3f7d94940bef1e.tar.gz
qemu: command: escape commas in chardev socket path
After this, a default virt-manager VM will startup with a comma in the VM name: https://bugzilla.redhat.com/show_bug.cgi?id=639926
-rw-r--r--src/qemu/qemu_command.c9
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-name-escape.args2
2 files changed, 5 insertions, 6 deletions
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index dfe773896e..7b54242d48 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4912,11 +4912,10 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
break;
case VIR_DOMAIN_CHR_TYPE_UNIX:
- virBufferAsprintf(&buf,
- "socket,id=char%s,path=%s%s",
- alias,
- dev->data.nix.path,
- dev->data.nix.listen ? ",server,nowait" : "");
+ virBufferAsprintf(&buf, "socket,id=char%s,path=", alias);
+ qemuBufferEscapeComma(&buf, dev->data.nix.path);
+ if (dev->data.nix.listen)
+ virBufferAddLit(&buf, ",server,nowait");
break;
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
index ffec3f4d12..b50b8c4afb 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
@@ -14,7 +14,7 @@ bar/master-key.aes \
-smp 1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-foo,bar/monitor.sock,\
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-foo,,bar/monitor.sock,\
server,nowait \
-mon chardev=charmonitor,id=monitor,mode=readline \
-no-acpi \