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.