On 11/22/2010 01:08 PM, Eric Blake wrote:
On 11/22/2010 10:28 AM, Cole Robinson wrote:
> If we don't escape ' or \ xend can't parse the generated sexpr. This
> might over apply the EscapeSexpr routine, but it shouldn't hurt.
>
> Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
> ---
> src/util/buf.c | 55 ++++++++++++++
> src/util/buf.h | 1 +
> src/xen/xend_internal.c | 112 +++++++++++++++------------
> tests/xml2sexprdata/xml2sexpr-escape.sexpr | 1 +
> tests/xml2sexprdata/xml2sexpr-escape.xml | 24 ++++++
> tests/xml2sexprtest.c | 1 +
> 6 files changed, 144 insertions(+), 50 deletions(-)
> create mode 100644 tests/xml2sexprdata/xml2sexpr-escape.sexpr
> create mode 100644 tests/xml2sexprdata/xml2sexpr-escape.xml
ACK series, with two nits:
You also need to update src/libvirt_private.syms:
diff --git i/src/libvirt_private.syms w/src/libvirt_private.syms
index 9ed05df..edbc4bc 100644
--- i/src/libvirt_private.syms
+++ w/src/libvirt_private.syms
@@ -23,6 +23,7 @@ virBufferAdd;
virBufferAddChar;
virBufferContentAndReset;
virBufferError;
+virBufferEscapeSexpr;
virBufferEscapeString;
virBufferFreeAndReset;
virBufferStrcat;
> @@ -5322,8 +5322,9 @@ xenDaemonFormatSxprChr(virDomainChrDefPtr def,
> break;
>
> case VIR_DOMAIN_CHR_TYPE_UNIX:
> - virBufferVSprintf(buf, "%s:%s%s", type,
> - def->data.nix.path,
> + virBufferVSprintf(buf, "%s:", type);
> + virBufferEscapeSexpr(buf, "%s", def->data.nix.path);
> + virBufferVSprintf(buf, "%s",
> def->data.nix.listen ? ",server,nowait" :
"");
Change that last line to:
if (def->data.nix.listen)
virBufferAddLit(buf, ",server,nowait");
Thanks, pushed with those changes.
- Cole