[Libguestfs] [PATCH] lvm: support lvm2 older than 2.02.107

Pino Toscano ptoscano at redhat.com
Thu Jan 28 13:53:28 UTC 2016


On Thursday 28 January 2016 13:47:30 Richard W.M. Jones wrote:
> On Wed, Jan 27, 2016 at 07:06:46PM +0100, Pino Toscano wrote:
> >  char **
> >  do_lvs (void)
> >  {
> >    char *out;
> >    CLEANUP_FREE char *err = NULL;
> >    int r;
> > +  int has_S = test_lvs_has_S_opt ();
> > +  if (has_S < 0)
> >      return NULL;
> 
> I think this doesn't do the right thing on the second failing call
> to test_lvs_has_S_opt, because it won't return a protocol error?

test_lvs_has_S_opt caches the result only if != -1, so if executing
"lvm lvs --help" fails then an error is replied and nothing is cached;
next time the command will be tried again.

> > +  /*NOTREACHED*/
> > +  assert (false);
> > +  return NULL;
> >  }
> 
> What's this bit for?  It is indeed NOTREACHED, but it seems as if
> the 3 lines could just be removed.

It was a simple extra safety belt, since IIRC past versions of GCC
could not recognize such case was indeed not reachable. I guess this
can be added in case it is misreported.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160128/ddbf26f0/attachment.sig>


More information about the Libguestfs mailing list