Fix build and tests on non-Linux (Hurd)

Pino Toscano toscano.pino at tiscali.it
Tue Jun 30 06:39:58 UTC 2015


Hi,

In data sabato 27 giugno 2015 23:31:29, Mark Wielaard ha scritto:
> > > > I get a clearer error message about this with:
> > > > 
> > > > diff --git a/tests/allregs.c b/tests/allregs.c
> > > > index 901d4e8..d3d459e 100644
> > > > --- a/tests/allregs.c
> > > > +++ b/tests/allregs.c
> > > > @@ -158,6 +158,8 @@ main (int argc, char **argv)
> > > > 
> > > >    Dwfl_Module *mod = NULL;
> > > >    if (dwfl_getmodules (dwfl, &first_module, &mod, 0) < 0)
> > > >      error (EXIT_FAILURE, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1));
> > > > +  if (mod == NULL)
> > > > +    error (EXIT_FAILURE, 0, "dwfl_getmodules: module not found");
> > > > 
> > > >    if (remaining == argc)
> > > >    
> > > >      {
> > > 
> > > Better to see first if dwfl_errno () == 0. It it is non-zero we do
> > > want to print the actual error reported.
> > 
> > Do you mean if dwfl_getmodules fails (i.e. in the existing error()
> > message), or before the check I proposed?
> 
> I meant something like:
> 
>   if (dwfl_getmodules (dwfl, &first_module, &mod, 0) < 0)
>     {
>       int de = dwfl_errno ();
>       if (de != 0)
>         error (EXIT_FAILURE, 0, "dwfl_getmodules: module not found");
>       else
>         error (EXIT_FAILURE, 0, "dwfl_getmodules: %s", dwfl_errmsg (de));
> }

I can see now what you mean; OTOH that still will not cover the case
when there are no modules available: dwfl_getmodules would pass through
the if...else if chains, pass through the while (m != NULL) loop, and
simply return 0.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.fedorahosted.org/pipermail/elfutils-devel/attachments/20150630/ca59e953/attachment.sig>


More information about the elfutils-devel mailing list