qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH][RESEND] qemu: jaso-parser: Output the content of invalid keyword
@ 2010-03-24 12:17 Amos Kong
  2010-03-24 12:21 ` Richard Henderson
  0 siblings, 1 reply; 5+ messages in thread
From: Amos Kong @ 2010-03-24 12:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Amos Kong, aurelien

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu: jaso-parser: Output the content of invalid keyword
@ 2010-03-27 12:52 Aurelien Jarno
  0 siblings, 0 replies; 5+ messages in thread
From: Aurelien Jarno @ 2010-03-27 12:52 UTC (permalink / raw)
  To: Amos Kong; +Cc: qemu-devel, kvm, Richard Henderson

On Wed, Mar 24, 2010 at 11:12:05PM +0800, Amos Kong wrote:
> 
> When input some invialid word 'unknowcmd' through QMP port, qemu outputs this
> error message:
> "parse error: invalid keyword `%s'"
> This patch makes qemu output the content of invalid keyword, like:
> "parse error: invalid keyword `unknowcmd'"

Thanks, applied.

> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  json-parser.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/json-parser.c b/json-parser.c
> index 579928f..b55d763 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,12 @@ 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");
> +    va_end(ap);
>  }
>  
>  /**
> -- 
> 1.6.3.3
> 
> 
> 
> 

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-27 12:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1269424853-15386-1-git-send-email-akong@redhat.com>
     [not found] ` <20100324102940.GA22874@hall.aurel32.net>
2010-03-24 11:34   ` [Qemu-devel] [PATCH] qemu: jaso-parser: Output the content of invalid keyword Amos Kong
2010-03-24 12:17 [Qemu-devel] [PATCH][RESEND] " 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 20:38       ` Luiz Capitulino
  -- strict thread matches above, loose matches on Subject: below --
2010-03-27 12:52 Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).