[libvirt] [PATCH] Fix qemuProcessReadLog with non-zero offset

This restores the error message when QMP probing is not used. https://bugzilla.redhat.com/show_bug.cgi?id=991334 --- src/qemu/qemu_process.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0dccac3..31de759 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1435,18 +1435,17 @@ qemuProcessReadLog(int fd, char *buf, int buflen, int off) ssize_t bytes; char *eol; - buf[0] = '\0'; - while (off < buflen - 1) { bytes = saferead(fd, buf + off, buflen - off - 1); if (bytes < 0) return -1; - else if (bytes == 0) - break; off += bytes; buf[off] = '\0'; + if (bytes == 0) + break; + /* Filter out debug messages from intermediate libvirt process */ while ((eol = strchr(filter_next, '\n'))) { *eol = '\0'; -- 1.8.1.5

On 08/15/2013 07:10 AM, Ján Tomko wrote:
This restores the error message when QMP probing is not used.
https://bugzilla.redhat.com/show_bug.cgi?id=991334 --- src/qemu/qemu_process.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
ACK.
+++ b/src/qemu/qemu_process.c @@ -1435,18 +1435,17 @@ qemuProcessReadLog(int fd, char *buf, int buflen, int off) ssize_t bytes; char *eol;
- buf[0] = '\0';
A smaller fix might be to change this to buf[off] = '\0'; but your way is just fine as is. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 08/15/2013 03:18 PM, Eric Blake wrote:
On 08/15/2013 07:10 AM, Ján Tomko wrote:
This restores the error message when QMP probing is not used.
https://bugzilla.redhat.com/show_bug.cgi?id=991334 --- src/qemu/qemu_process.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
ACK.
+++ b/src/qemu/qemu_process.c @@ -1435,18 +1435,17 @@ qemuProcessReadLog(int fd, char *buf, int buflen, int off) ssize_t bytes; char *eol;
- buf[0] = '\0';
A smaller fix might be to change this to buf[off] = '\0'; but your way is just fine as is.
Thanks, pushed now. Jan
participants (2)
-
Eric Blake
-
Ján Tomko