This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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
Attachment:
signature.asc
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |