Skip to contentSkip to conversation

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

PATCH In review Amos Kong 3 participants 5 messages Mar 24, 2010 KVM

lore
Share & tools
lore

Amos Kong

author
#0 lore raw

PATCH 1/1 qemu-kvm: 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.

---
 json-parser.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
json-parser.c +6 -1
index 579928f..98a82af 100644
@@ -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.6.3.3
#1 lore raw

Hi,

Quoted 3 lines · Amos Kong

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.

Is this patch for QEMU or KVM? If it is for QEMU, you should put the QEMU mailing list in Cc:. If it is for KVM, I don't have commit access there.

Quoted 34 lines
---
 json-parser.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
json-parser.c +6 -1
index 579928f..98a82af 100644
@@ -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.6.3.3
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
author
#2 lore raw

PATCH 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
index 579928f..98a82af 100644
@@ -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
author
#3 lore raw

PATCH 1/1 qemu: jaso-parser: Output the content of invalid keyword

In reply to Aurelien Jarno

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
index 579928f..98a82af 100644
@@ -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
#4 lore raw
In reply to Aurelien Jarno
Quoted 10 lines · On Wed, 24 Mar 2010 11:29:40 +0100 Aurelien Jarno <[email protected]> wrote:

Hi,

Quoted 3 lines · Amos Kong

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.

Is this patch for QEMU or KVM? If it is for QEMU, you should put the QEMU mailing list in Cc:. If it is for KVM, I don't have commit access there.

It's for QEMU and looks good to me.

Amos, can you resend there please? Just to take the right route..

Quoted 36 lines
Quoted 35 lines
---
 json-parser.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
json-parser.c +6 -1
index 579928f..98a82af 100644
@@ -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.6.3.3