summaryrefslogtreecommitdiffstats
path: root/src/readelf.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2008-12-03 03:41:58 +0000
committerRoland McGrath <[email protected]>2008-12-03 03:41:58 +0000
commita845f68bf43f90e0670ed6b33154f2aff98ad46b (patch)
tree3bc6809479ef0de95b106f0f8616ca8cb0c02cc2 /src/readelf.c
parenta4c9d281616090c46ffc4fc3234d64e915008e1a (diff)
src/
2008-12-02 Roland McGrath <[email protected]> * readelf.c (count_dwflmod, process_file): Don't presume encoding of nonzero OFFSET argument to dwfl_getmodules.
Diffstat (limited to 'src/readelf.c')
-rw-r--r--src/readelf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/readelf.c b/src/readelf.c
index 7b599ec8..2797a849 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -459,8 +459,10 @@ count_dwflmod (Dwfl_Module *dwflmod __attribute__ ((unused)),
Dwarf_Addr base __attribute__ ((unused)),
void *arg)
{
- *(bool *) arg = false;
- return DWARF_CB_ABORT;
+ if (*(bool *) arg)
+ return DWARF_CB_ABORT;
+ *(bool *) arg = true;
+ return DWARF_CB_OK;
}
struct process_dwflmod_args
@@ -548,8 +550,11 @@ process_file (int fd, const char *fname, bool only_one)
dwfl_report_end (dwfl, NULL, NULL);
if (only_one)
- /* Clear ONLY_ONE if we have multiple modules, from an archive. */
- dwfl_getmodules (dwfl, &count_dwflmod, &only_one, 1);
+ {
+ /* Clear ONLY_ONE if we have multiple modules, from an archive. */
+ bool seen = false;
+ only_one = dwfl_getmodules (dwfl, &count_dwflmod, &seen, 0) == 0;
+ }
/* Process the one or more modules gleaned from this file. */
struct process_dwflmod_args a = { .fd = fd, .only_one = only_one };