[libvirt] [PATCH] util: choose whether to require micro in version strings
Eric Blake
eblake at redhat.com
Fri Jul 1 17:03:32 UTC 2011
On 07/01/2011 10:54 AM, Eric Blake wrote:
> +++ w/src/util/util.c
> @@ -1619,6 +1619,9 @@ virParseVersionString(const char *str, unsigned
> long *version,
> if ((*tmp == '.') && virStrToLong_ui(tmp + 1, &tmp, 10, µ) < 0)
> return -1;
>
> + if (major > ULONG_MAX / 1000000 || minor > 999 || micro > 999)
s/ULONG_MAX/UINT_MAX/
to silence a compiler warning, and to deal with the fact that even
though this function populates an 'unsigned long *version', the only
reason it does so is because of our (poor) choice in making
virGetVersion use unsigned long. But for portability to 32-bit hosts,
we can never exceed a 32-bit version computation, even on hosts where
long is 64-bits.
--
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/20110701/588d1fdc/attachment-0001.sig>
More information about the libvir-list
mailing list