Re: [PATCH 1/8] util: conf: Use long long when parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2016-07-18 at 09:16 +0100, Daniel P. Berrange wrote:
> On Fri, Jul 15, 2016 at 07:46:23PM +0200, Andrea Bolognani wrote:
> > 
> > Commit 6381c89f8cce changed virConfValue to store long long
> > integers instead of long integers; however, the temporary variable
> > used in virConfParseLong() was not updated accordingly, causing
> > trouble for 32-bit machines.
> > ---
> >  src/util/virconf.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/util/virconf.c b/src/util/virconf.c
> > index 33d6d92..66f8144 100644
> > --- a/src/util/virconf.c
> > +++ b/src/util/virconf.c
> > @@ -364,9 +364,9 @@ virConfSaveEntry(virBufferPtr buf, virConfEntryPtr cur)
> >   * Returns 0 in case of success and -1 in case of error
> >   */
> >  static int
> > -virConfParseLong(virConfParserCtxtPtr ctxt, long *val)
> > +virConfParseLong(virConfParserCtxtPtr ctxt, long long *val)
> >  {
> > -    long l = 0;
> > +    long long l = 0;
> >      int neg = 0;
> >  
> >      if (CUR == '-') {
> > @@ -476,7 +476,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
> >      virConfValuePtr ret, lst = NULL, tmp, prev;
> >      virConfType type = VIR_CONF_NONE;
> >      char *str = NULL;
> > -    long  l = 0;
> > +    long long l = 0;
> >  
> >      SKIP_BLANKS;
> >      if (ctxt->cur >= ctxt->end) {
> 
> ACK, but perhaps you could add a test case to tests/virconftest to
> validate this too.

virconftest will already fail without this patch:

  4) int   ... Expected -6963472309248 got -1330322432

because the call to virConfGetValueLLong() will not be able
to return the correct value. So I think we're covered.

I've pushed the whole series, thanks for reviewing it!

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]