[libvirt] [PATCH] Check that virsh -d argument is numeric
Eric Blake
eblake at redhat.com
Mon Aug 2 18:19:54 UTC 2010
On 08/02/2010 09:30 AM, Daniel Veillard wrote:
> Having been bitten one more time by the use of -d to pass the
> hypervisor URI instead of -c (confusion coming from CVS using
> -d to specify the root), I suggest to drop atoi and use the
> function with checking and error out with proper explanation instead
> of silently failing !
Hear hear - atoi() is inherently stupid. There's a 'make syntax-check'
that we could turn on to prohibit all use of atoi(), but I don't know if
the code base is ready for that, so I'll save it for another patch on
another day.
> paphio:~/libvirt -> tools/virsh -d qemu+ssh://test2/system list
> error: option -d take a numeric argument
+ if (virStrToLong_i(optarg, NULL, 10, &ctl->debug) < 0) {
Any reason you are still requiring decimal, or would it make more sense
to branch out and s/10/0/ in order to also accept hex?
At any rate, ACK to the patch.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100802/b6d54046/attachment-0001.sig>
More information about the libvir-list
mailing list