Re: [libvirt] [PATCH] virBufferEscapeShell: Fix escaping of single quotes.

2011-10-18 Thread Eric Blake

On 10/18/2011 01:31 AM, Guido Günther wrote:

When checking if we need to escape a single quote we were looking at the
character after the quote instead of at the quote itself.

---
  src/util/buf.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


ACK, and sorry for missing that earlier.

--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


Re: [libvirt] [PATCH] virBufferEscapeShell: Fix escaping of single quotes.

2011-10-18 Thread Guido Günther
On Tue, Oct 18, 2011 at 08:39:48AM -0600, Eric Blake wrote:
> On 10/18/2011 01:31 AM, Guido Günther wrote:
> >When checking if we need to escape a single quote we were looking at the
> >character after the quote instead of at the quote itself.
> >
> >---
> >  src/util/buf.c |4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> ACK, and sorry for missing that earlier.
Pushed, Thanks and sorry for pushing the broken version.
Cheers,
 -- Guido

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


[libvirt] [PATCH] virBufferEscapeShell: Fix escaping of single quotes.

2011-10-18 Thread Guido Günther
When checking if we need to escape a single quote we were looking at the
character after the quote instead of at the quote itself.

---
 src/util/buf.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/buf.c b/src/util/buf.c
index 7dd9852..2d9499a 100644
--- a/src/util/buf.c
+++ b/src/util/buf.c
@@ -524,13 +524,13 @@ virBufferEscapeShell(virBufferPtr buf, const char *str)
 
 *out++ = '\'';
 while (*cur != 0) {
-*out++ = *cur++;
 if (*cur == '\'') {
+*out++ = '\'';
 /* Replace literal ' with a close ', a \', and a open ' */
 *out++ = '\\';
 *out++ = '\'';
-*out++ = '\'';
 }
+*out++ = *cur++;
 }
 *out++ = '\'';
 *out = 0;
-- 
1.7.6.3

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