On 01/28/2011 05:11 AM, Osier Yang wrote: > ä 2011å01æ28æ 20:02, Daniel P. Berrange åé: >> On Fri, Jan 28, 2011 at 07:53:44PM +0800, Osier Yang wrote: >>> As cgroup doesn't allow one writes negative into files like cpu.shares, >>> (e.g. echo -1> /cgroup/cpu/libvirt/qemu/rhel6/cpu.shares), user will be >>> confused if libvirt accepts negative value and converts it into unsigned >>> int (or long int, etc) silently. But strtoul() is explicitly documented as accepting -1 as shorthand for ULONG_MAX, and as a command-line convenience, I much prefer that shorthand over 18446744073709551615. I don't see this as confusing. >> >> Surely this check should be done inside virStrToLong_{ui,ul,ull} If we want to be sticklers about reject '-' and module 2^32 (2^64) wraparound, then yes, virStrToLong_u* would be the place to do it. But I'm not convinced that this is a good change. > Is there some codes that expects virStrToLong_{ui,ul,ull} to convert > the negative to {ui, ul, ull}? Probably, given the above arguments about -1 being useful shorthand for the maximum value. -- 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