[libvirt] [PATCH V2] virsh: forbid negative vcpu argument to vcpupin.

Peter Krempa pkrempa at redhat.com
Thu May 29 14:53:45 UTC 2014


On 05/29/14 16:51, Eric Blake wrote:
> On 05/29/2014 05:47 AM, Peter Krempa wrote:
> 
>> Still not quite right ... vshCommandOptUInt currently wraps negative
>> numbers to their 2's complement and stores them in the uint.
> 
> I recently tweaked virstring.c to provide virStrToLong_uip and friends
> for rejecting negative input when parsing unsigned numbers.
> 
> The intent was that we need to make a case-by-case decision on which of
> the two parsing styles to use - sometimes, wrapping -1 to max is
> desirable, other times it is not.
> 
>>
>> We need to modify the vshCommandOptUInt helper to reject negative numbers.
> 
> It may mean that we need two flavors of vshCommandOptUInt.
> 

Actually we don't. All callers of vshCommandOptUInt don't expect to use
the wrap-to-2's-complement "feature". I've sent a V3 that does exactly that.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140529/48e42236/attachment-0001.sig>


More information about the libvir-list mailing list