Add comma escaping for fileval.
Signed-off-by: Anya Harter <aharter(a)redhat.com>
---
src/qemu/qemu_command.c | 3 ++-
tests/qemuxml2argvdata/name-escape.args | 2 ++
tests/qemuxml2argvdata/name-escape.xml | 4 ++++
tests/qemuxml2argvtest.c | 3 ++-
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b764008949..40e8f8fccf 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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));
diff --git a/tests/qemuxml2argvdata/name-escape.args
b/tests/qemuxml2argvdata/name-escape.args
index 4b03068f95..35a13b2533 100644
--- a/tests/qemuxml2argvdata/name-escape.args
+++ b/tests/qemuxml2argvdata/name-escape.args
@@ -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 \
diff --git a/tests/qemuxml2argvdata/name-escape.xml
b/tests/qemuxml2argvdata/name-escape.xml
index 3f5e1c9829..79c1b34458 100644
--- a/tests/qemuxml2argvdata/name-escape.xml
+++ b/tests/qemuxml2argvdata/name-escape.xml
@@ -23,6 +23,10 @@
<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'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c194ff59c9..3e02fa576c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2761,7 +2761,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);
--
2.17.1