Patchwork [V3,03/13] libxl_qmp: Better error message after a parse error.

login
register
mail settings
Submitter Anthony PERARD
Date Nov. 1, 2011, 4:07 p.m.
Message ID <1320163646-24291-4-git-send-email-anthony.perard@citrix.com>
Download mbox | patch
Permalink /patch/123088/
State New
Headers show

Comments

Anthony PERARD - Nov. 1, 2011, 4:07 p.m.
By setting the next string to parse after having printed any error messages.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libxl/libxl_qmp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index ef36348..f61a87a 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -403,7 +403,6 @@  static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp)
                 *end = '\0';
 
                 o = libxl__json_parse(gc, s);
-                s = end + 2;
 
                 if (o) {
                     qmp_handle_response(qmp, o);
@@ -413,6 +412,8 @@  static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp)
                                "Parse error of : %s\n", s);
                     return -1;
                 }
+
+                s = end + 2;
             } else {
                 break;
             }