diff mbox

[3/4] qemu: command: escape commas in chardev socket path

Message ID 68440923f8f0aa1b317d044c0d73435c21e887e9.1461365053.git.crobinso@redhat.com
State Superseded
Headers show

Commit Message

Cole Robinson April 22, 2016, 10:46 p.m. UTC
---
 src/qemu/qemu_command.c                              | 9 ++++-----
 tests/qemuxml2argvdata/qemuxml2argv-name-escape.args | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

-- 
2.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6defa56..262e8d9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4772,11 +4772,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);
+        virBufferEscape(&buf, ',', ",", "%s", 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 a5e35b8..772d94f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
@@ -15,7 +15,7 @@  bar/master-key.aes \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
 -nographic \
 -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 \