Re: [PATCH] Check that virsh -d argument is numeric

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

 



On 08/02/2010 01:49 PM, Eric Blake wrote:
> 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 !
> 
>> +                vshError(ctl, _("option -d takes a numeric argument"), arg);
> 
> Serves me right for not noticing this; gcc complained that the printf
> string doesn't match the number of arguments.
> 
> I'm pushing this trivial followup:
> 
> diff --git i/tools/virsh.c w/tools/virsh.c
> index 926652a..cedfb5a 100644
> --- i/tools/virsh.c
> +++ w/tools/virsh.c
> @@ -11022,7 +11022,7 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
>          switch (arg) {
>          case 'd':
>              if (virStrToLong_i(optarg, NULL, 10, &ctl->debug) < 0) {
> -                vshError(ctl, _("option -d takes a numeric argument"),
> arg);
> +                vshError(ctl, _("option -d takes a numeric argument:
> %s"), arg);

Or, better yet:

+                vshError(ctl, _("option -d takes a numeric argument));

since arg is not a string to be printed with %s.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]