From: John Snow <jsnow@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 3/3] qemu-io: Correct error messages
Date: Mon, 26 Oct 2015 18:54:40 -0400 [thread overview]
Message-ID: <562EAF30.5070405@redhat.com> (raw)
In-Reply-To: <562EAF0C.2020604@redhat.com>
On 10/26/2015 06:54 PM, Eric Blake wrote:
> On 10/26/2015 04:06 PM, John Snow wrote:
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>> 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 <eblake@redhat.com>
>
>> @@ -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?
>
Yes.
prev parent reply other threads:[~2015-10-26 22:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-26 22:06 [Qemu-devel] [PATCH 0/3] qemu-io: clean up cvtnum usage John Snow
2015-10-26 22:06 ` [Qemu-devel] [PATCH 1/3] qemu-io: fix cvtnum lval types John Snow
2015-10-26 22:40 ` Eric Blake
2015-10-26 22:51 ` Eric Blake
2015-10-26 22:06 ` [Qemu-devel] [PATCH 2/3] qemu-io: Check for trailing chars John Snow
2015-10-26 22:44 ` Eric Blake
2015-10-26 22:49 ` [Qemu-devel] [Qemu-block] " Eric Blake
2015-10-26 22:06 ` [Qemu-devel] [PATCH 3/3] qemu-io: Correct error messages John Snow
2015-10-26 22:54 ` Eric Blake
2015-10-26 22:54 ` John Snow [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=562EAF30.5070405@redhat.com \
--to=jsnow@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.