qemu: jaso-parser: Output the content of invalid keyword
PATCH RESEND 1/1 qemu: jaso-parser: Output the content of invalid keyword
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'"
--- json-parser.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
json-parser.c +6 -1
@@ -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" ); }/**
Signature · 1 line
1.5.5.6
json-parser.c static int token_is_escape(QObject *obj, const char *value) · line 101
Quoted 6 lines · Amos Kong
json-parser.c +5
-1-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" );
Technically you need va_end here.
r~
PATCH 1/1 qemu: jaso-parser: Output the content of invalid keyword
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'"
--- json-parser.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
json-parser.c +7 -1
@@ -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); }/**
Signature · 1 line
1.6.3.3
PATCH 1/1 qemu: jaso-parser: Output the content of invalid keyword
In reply to Richard HendersonWhen 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'"
--- json-parser.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
json-parser.c +7 -1
@@ -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); }/**
Signature · 1 line
1.6.3.3
Quoted 7 lines · Amos Kong
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'"Signed-off-by Amos Kong <[email protected]>
Looks good to me.
Hint: it's best to put a version in the subject when you respin, like [PATCH v2] ...
Quoted 8 lines · On Wed, 24 Mar 2010 17:00:14 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 6 lines · Amos Kong
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'"
Quoted 6 lines
Quoted 1 line
Signed-off-by Amos Kong <[email protected]>Looks good to me.
Hint: it's best to put a version in the subject when you respin, like [PATCH v2] ...
Yes, and maintainers may miss a patch down a thread (and it's a good
opportunity to fix the subject).
Quoted 8 lines · Amos Kong
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'"Signed-off-by Amos Kong <[email protected]>
Quoted 30 lines
--- json-parser.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)json-parser.c +7
-1@@ -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); }/**