提交 c96c84a9 编写于 作者: A Amos Kong 提交者: Aurelien Jarno

json-parser: Output the content of invalid keyword

When input some invalid 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: NAmos Kong <akong@redhat.com>
Acked-by: NRichard Henderson <rth@redhat.com>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 57e69b7d
......@@ -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);
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册