All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net, kvm@vger.kernel.org
Subject: [Qemu-devel] [PATCH] qemu: jaso-parser: Output the content of invalid keyword
Date: Wed, 24 Mar 2010 19:34:41 +0800	[thread overview]
Message-ID: <20100324113441.GA5971@akong@redhat.com> (raw)
In-Reply-To: <20100324102940.GA22874@hall.aurel32.net>


When input some invialid words in QMP port, qemu outputs this error message:
"parse error: invalid keyword `%s'"
This patch makes qemu output the content, like:
"parse error: invalid keyword `unknow_cmd'"

Signed-off-by: Amos Kong <akong@redhat.com>
---
 json-parser.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/json-parser.c b/json-parser.c
index 579928f..98a82af 100644
--- a/json-parser.c
+++ b/json-parser.c
@@ -12,6 +12,7 @@
  */
 
 #include <stdbool.h>
+#include <stdarg.h>
 
 #include "qemu-common.h"
 #include "qstring.h"
@@ -93,7 +94,11 @@ static int token_is_escape(QObject *obj, const char *value)
  */
 static void parse_error(JSONParserContext *ctxt, QObject *token, const char *msg, ...)
 {
-    fprintf(stderr, "parse error: %s\n", msg);
+    va_list ap;
+    va_start(ap, msg);
+    fprintf(stderr, "parse error: ");
+    vfprintf(stderr, msg, ap);
+    fprintf(stderr, "\n");
 }
 
 /**
-- 
1.5.5.6

  reply	other threads:[~2010-03-24 11:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-24 10:00 [PATCH] qemu-kvm: jaso-parser: Output the content of invalid keyword Amos Kong
2010-03-24 10:29 ` Aurelien Jarno
2010-03-24 11:34   ` Amos Kong [this message]
2010-03-24 11:34   ` [PATCH] qemu: " Amos Kong
2010-03-24 14:03   ` [PATCH] qemu-kvm: " Luiz Capitulino
  -- strict thread matches above, loose matches on Subject: below --
2010-03-24 12:17 [Qemu-devel] [PATCH][RESEND] qemu: " Amos Kong
2010-03-24 12:21 ` Richard Henderson
2010-03-24 15:12   ` [Qemu-devel] [PATCH] " Amos Kong
2010-03-24 16:00     ` Markus Armbruster
2010-03-24 16:00       ` Markus Armbruster
2010-03-24 20:38       ` Luiz Capitulino
2010-03-24 20:38         ` Luiz Capitulino
2010-03-27 12:52 Aurelien Jarno
2010-03-27 12:52 ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100324113441.GA5971@akong@redhat.com \
    --to=akong@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.