]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Escape commas for qemuBuildChrChardevFileStr
authorAnya Harter <aharter@redhat.com>
Mon, 18 Jun 2018 17:57:24 +0000 (13:57 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 18 Jun 2018 23:39:02 +0000 (19:39 -0400)
Add comma escaping for fileval.

Signed-off-by: Anya Harter <aharter@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/name-escape.args
tests/qemuxml2argvdata/name-escape.xml
tests/qemuxml2argvtest.c

index b7640089495096ca97049fc0fa814c0358050683..40e8f8fccf992fe68f878ac31ed55926cdfe05f0 100644 (file)
@@ -4867,7 +4867,8 @@ qemuBuildChrChardevFileStr(virLogManagerPtr logManager,
         virBufferAsprintf(buf, ",%s=%s,%s=on", filearg, fdpath, appendarg);
         VIR_FREE(fdpath);
     } else {
-        virBufferAsprintf(buf, ",%s=%s", filearg, fileval);
+        virBufferAsprintf(buf, ",%s=", filearg);
+        virQEMUBuildBufferEscapeComma(buf, fileval);
         if (appendval != VIR_TRISTATE_SWITCH_ABSENT) {
             virBufferAsprintf(buf, ",%s=%s", appendarg,
                               virTristateSwitchTypeToString(appendval));
index 4b03068f950dd64dec7c297c21d35dda926a66b2..35a13b25332002f20176f3ccfab6ee722532b819 100644 (file)
@@ -25,6 +25,8 @@ bar=2/monitor.sock,server,nowait \
 -usb \
 -chardev tty,id=charserial0,path=/dev/ttyS2,,foo \
 -device isa-serial,chardev=charserial0,id=serial0 \
+-chardev file,id=charserial1,path=/tmp/serial.log,,foo,append=on \
+-device isa-serial,chardev=charserial1,id=serial1 \
 -chardev pipe,id=charchannel0,path=/tmp/guestfwd,,foo \
 -netdev user,guestfwd=tcp:10.0.2.1:4600-chardev:charchannel0,id=user-channel0 \
 -vnc unix:/tmp/lib/domain--1-foo=1,,bar=2/vnc.sock \
index 3f5e1c9829aec63902000f50c0e4acfe24e1b9b3..79c1b34458e150a34176c66d091b8f9734590731 100644 (file)
     <serial type='dev'>
       <source path='/dev/ttyS2,foo'/>
     </serial>
+    <serial type='file'>
+      <source path='/tmp/serial.log,foo' append='on'/>
+      <target port='0'/>
+    </serial>
     <channel type='pipe'>
       <source path='/tmp/guestfwd,foo'/>
       <target type='guestfwd' address='10.0.2.1' port='4600'/>
index f15454101275d99874aa6f509d5e42ecef5b6580..18888872db05719ce3037593f53c5086ec64a741 100644 (file)
@@ -2763,7 +2763,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_CIRRUS_VGA,
             QEMU_CAPS_SPICE,
             QEMU_CAPS_SPICE_UNIX,
-            QEMU_CAPS_DEVICE_ISA_SERIAL);
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
+            QEMU_CAPS_CHARDEV_FILE_APPEND);
     DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);
 
     DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);