On Wed, May 18, 2016 at 12:31:26PM +0200, Pino Toscano wrote:
bool guestfs_int_version_ge (const struct version *v, int maj, int min, int mic) { return VERSION_STRUCT_TO_NUMBER(v) >= VERSION_TO_NUMBER(maj, min, mic); } + +bool +guestfs_int_version_cmp_ge (const struct version *a, const struct version *b) +{ + return VERSION_STRUCT_TO_NUMBER(a) >= VERSION_STRUCT_TO_NUMBER(b); +}
My only worry about this patch series are these two functions. It seems as if turning the separate fields into a single number could be problematic if any of the major/minor/release fields is >= 1000. That's not a problem for the qemu stuff, but it's a problem for inspection where these fields are entirely controlled by the untrusted guest. So I think we should code these two functions by comparing the three fields. ACK with that change. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html