diff mbox

[v3,4/6] qemu: command: escape commas in VNC socket path

Message ID 546b4277303af6c57f838785b34a81ef9b57506b.1462732781.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson May 8, 2016, 6:43 p.m. UTC
This path can be dependent on the VM libdir, which contains its name
---
 src/qemu/qemu_command.c                              | 3 ++-
 tests/qemuxml2argvdata/qemuxml2argv-name-escape.args | 3 ++-
 tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml  | 1 +
 tests/qemuxml2argvtest.c                             | 2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.7.4

--
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 067a8c3..22fb51c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7427,7 +7427,8 @@  qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
             graphics->data.vnc.socketAutogenerated = true;
         }
 
-        virBufferAsprintf(&opt, "unix:%s", graphics->data.vnc.socket);
+        virBufferAddLit(&opt, "unix:");
+        qemuBufferEscapeComma(&opt, graphics->data.vnc.socket);
 
     } else {
         if (!graphics->data.vnc.autoport &&
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
index a5e35b8..ffec3f4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
@@ -13,7 +13,6 @@  bar/master-key.aes \
 -m 214 \
 -smp 1 \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--nographic \
 -nodefaults \
 -chardev socket,id=charmonitor,path=/tmp/lib/domain--1-foo,bar/monitor.sock,\
 server,nowait \
@@ -21,4 +20,6 @@  server,nowait \
 -no-acpi \
 -boot c \
 -usb \
+-vnc unix:/tmp/bar,,foo.sock \
+-vga cirrus \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml
index 3a8c3cd..e263553 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml
@@ -14,5 +14,6 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
+    <graphics type='vnc' socket='/tmp/bar,foo.sock'/>
   </devices>
 </domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d8834cb..5d15dfd 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1894,7 +1894,7 @@  mymain(void)
                               NONE);
 
     DO_TEST("name-escape", QEMU_CAPS_NAME_DEBUG_THREADS,
-            QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_CHARDEV);
+            QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_CHARDEV, QEMU_CAPS_VNC);
     DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);
 
     DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);