Skip to contentSkip to conversation

qemu: jaso-parser: Output the content of invalid keyword

PATCH Aurelien Jarno 1 participant 1 message Mar 27, 2010 KVM

lore
Share & tools
lore

Aurelien Jarno

author Applied
#0 lore raw
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'"

Thanks, applied.

Quoted 37 lines
---
 json-parser.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
json-parser.c +7 -1
index 579928f..b55d763 100644
@@ -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
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net