Re: [PATCH] qemu: jaso-parser: Output the content of invalid keyword

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/24/2010 08:12 AM, 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'"
> 
> Signed-off-by: Amos Kong <akong@xxxxxxxxxx>

Acked-by: Richard Henderson <rth@xxxxxxxxxx>

> ---
>  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);
>  }
>  
>  /**

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux