[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl_qmp: fix qmp_next to cope with multiple lines read in a single buffer
# HG changeset patch # User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> # Date 1327687100 0 # Node ID 502e0214bdb29ab5c6c8f2764e06604cc18e2635 # Parent 235ac9bf133826e8089949dc7a764ca70474ae91 libxl_qmp: fix qmp_next to cope with multiple lines read in a single buffer qmp_next doesn't handle multiple lines read together in a single buffer correctly at the moment. This patch fixes it. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- diff -r 235ac9bf1338 -r 502e0214bdb2 tools/libxl/libxl_qmp.c --- a/tools/libxl/libxl_qmp.c Fri Jan 27 17:48:14 2012 +0000 +++ b/tools/libxl/libxl_qmp.c Fri Jan 27 17:58:20 2012 +0000 @@ -408,17 +408,18 @@ char *end = NULL; if (incomplete) { size_t current_pos = s - incomplete; + incomplete = libxl__realloc(gc, incomplete, + incomplete_size + rd); + strncat(incomplete + incomplete_size, qmp->buffer, rd); + s = incomplete + current_pos; incomplete_size += rd; - incomplete = libxl__realloc(gc, incomplete, - incomplete_size + 1); - incomplete = strncat(incomplete, qmp->buffer, rd); - s = incomplete + current_pos; s_end = incomplete + incomplete_size; } else { incomplete = libxl__strndup(gc, qmp->buffer, rd); incomplete_size = rd; s = incomplete; s_end = s + rd; + rd = 0; } end = strstr(s, "\r\n"); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |