qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 3/3] qemu-io: Correct error messages


From: Eric Blake
Subject: Re: [Qemu-block] [PATCH 3/3] qemu-io: Correct error messages
Date: Mon, 26 Oct 2015 16:54:04 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/26/2015 04:06 PM, John Snow wrote:
> Signed-off-by: John Snow <address@hidden>
> ---
>  qemu-io-cmds.c | 58 
> +++++++++++++++++++++++++++++++++++++---------------------
>  1 file changed, 37 insertions(+), 21 deletions(-)
> 
> diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
> index e2477fc..92c6b87 100644
> --- a/qemu-io-cmds.c
> +++ b/qemu-io-cmds.c
> @@ -146,6 +146,21 @@ static int64_t cvtnum(const char *s)
>      return ret;
>  }
>  
> +static void print_cvtnum_err(int64_t rc, const char *arg)
> +{
> +    switch (rc) {
> +    case -EINVAL:
> +        printf("Parsing error: non-numeric argument,"
> +               " or extraneous/unrecognized suffix -- %s\n", arg);

s/ --/:/

> +        break;
> +    case -ERANGE:
> +        printf("Parsing error: argument too large -- %s\n", arg);
> +        break;
> +    default:
> +        printf("Parsing error -- %s\n", arg);

Twice more.

With that change,
Reviewed-by: Eric Blake <address@hidden>

> @@ -2199,10 +2214,11 @@ static int sigraise_f(BlockBackend *blk, int argc, 
> char **argv)
>  {
>      int64_t sig = cvtnum(argv[1]);
>      if (sig < 0) {
> -        printf("non-numeric signal number argument -- %s\n", argv[1]);
> +        print_cvtnum_err(sig, argv[1]);
>          return 0;
> -    } else if (sig > INT_MAX) {
> -        printf("signal argument '%s' is too large\n", argv[1]);
> +    } else if (sig > NSIG) {
> +        printf("signal argument '%s' is too large to be a valid signal\n",
> +               argv[1]);

Should the comparison against NSIG rather than INT_MAX be squashed into
patch 1?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]