[libvirt] [PATCH] build: use correct limit for unsigned long long

Daniel P. Berrange berrange at redhat.com
Mon Jul 2 09:26:40 UTC 2012


On Fri, Jun 29, 2012 at 03:11:41PM -0600, Eric Blake wrote:
> Reported by Jason Helfman as a build-breaker on FreeBSD.
> 
> * src/conf/domain_conf.c (virDomainFSDefParseXML): Use POSIX
> spelling.
> * src/openvz/openvz_conf.c (openvzReadFSConf): Likewise.
> ---
> 
> Pushing under the build-breaker rule.
> 
>  src/conf/domain_conf.c   |    8 +++-----
>  src/openvz/openvz_conf.c |    4 ++--
>  2 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 4086dac..3fb90db 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -4248,14 +4248,12 @@ virDomainFSDefParseXML(xmlNodePtr node,
> 
>      if (virDomainParseScaledValue("./space_hard_limit[1]", ctxt,
>                                    &def->space_hard_limit, 1,
> -                                  ULONG_LONG_MAX,
> -                                  false) < 0)
> +                                  ULLONG_MAX, false) < 0)
>          goto error;
> 
>      if (virDomainParseScaledValue("./space_soft_limit[1]", ctxt,
>                                    &def->space_soft_limit, 1,
> -                                  ULONG_LONG_MAX,
> -                                  false) < 0)
> +                                  ULLONG_MAX, false) < 0)
>          goto error;
> 
>      cur = node->children;
> @@ -4335,7 +4333,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
>          }
>          if (unit &&
>              virScaleInteger(&def->usage, unit,
> -                            1024, ULONG_LONG_MAX) < 0)
> +                            1024, ULLONG_MAX) < 0)
>              goto error;
>      }
> 
> diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
> index bb61b13..ad27d37 100644
> --- a/src/openvz/openvz_conf.c
> +++ b/src/openvz/openvz_conf.c
> @@ -455,8 +455,8 @@ openvzReadFSConf(virDomainDefPtr def,
>              goto error;
>          } else {
>              /* Ensure that we can multiply by 1024 without overflowing. */
> -            if (barrier > ULONG_LONG_MAX / 1024 ||
> -                limit > ULONG_LONG_MAX / 1024 ) {
> +            if (barrier > ULLONG_MAX / 1024 ||
> +                limit > ULLONG_MAX / 1024 ) {
>                  virReportSystemError(VIR_ERR_OVERFLOW,
>                                       _("%s"),
>                                       "Unable to parse quota");

Probably worth blacklisting the non-portable spelling with syntax-check


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list