On 10/26/2015 04:40 PM, Eric Blake wrote: > On 10/26/2015 04:06 PM, John Snow wrote: >> cvtnum() returns int64_t: we should not be storing this >> result inside of an int. >> >> In a few cases, we need an extra sprinkling of error handling >> where we expect to pass this number on towards a function that >> expects something smaller than int64_t. >> >> Signed-off-by: John Snow <js...@redhat.com> >> --- >> qemu-io-cmds.c | 30 ++++++++++++++++-------------- >> 1 file changed, 16 insertions(+), 14 deletions(-) >> > >> @@ -2191,10 +2190,13 @@ static const cmdinfo_t sigraise_cmd = { >> >> static int sigraise_f(BlockBackend *blk, int argc, char **argv) >> { >> - int sig = cvtnum(argv[1]); >> + int64_t sig = cvtnum(argv[1]); >> if (sig < 0) { >> printf("non-numeric signal number argument -- %s\n", argv[1]); >> return 0; > > Pre-existing: attempting to raise signal -1 claims that -1 is > non-numeric. Not the end of the world.
I stand corrected; cvtnum() returns -ERANGE if the user attempted to parse the string "-1" (that is, negative user input is not permitted, so we always have a sane errno value). [must be time for me to quit and eat some dinner...] > > Reviewed-by: Eric Blake <ebl...@redhat.com> > And of course this still stands. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature