diff options
author | Roland McGrath <roland@redhat.com> | 2010-01-07 20:24:34 -0800 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2010-01-07 20:24:34 -0800 |
commit | f95760aff004850544f83626404c134d6a07c630 (patch) | |
tree | 5e682173fecb47c8b33231819bc0e0f151b371c6 /libdwfl/dwfl_module_build_id.c | |
parent | bd733cae5159e3a3c4c05f7685559fa3ae8b58c6 (diff) | |
download | elfutils-f95760aff004850544f83626404c134d6a07c630.tar.gz |
Use elf_getphdrnum in libdw and libdwfl.
Diffstat (limited to 'libdwfl/dwfl_module_build_id.c')
-rw-r--r-- | libdwfl/dwfl_module_build_id.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c index 07a62ba4..9dc7f678 100644 --- a/libdwfl/dwfl_module_build_id.c +++ b/libdwfl/dwfl_module_build_id.c @@ -1,5 +1,5 @@ /* Return build ID information for a module. - Copyright (C) 2007, 2008, 2009 Red Hat, Inc. + Copyright (C) 2007-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -107,12 +107,14 @@ __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf) /* No sections, have to look for phdrs. */ GElf_Ehdr ehdr_mem; GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); - if (unlikely (ehdr == NULL)) + size_t phnum; + if (unlikely (ehdr == NULL) + || unlikely (elf_getphdrnum (elf, &phnum) != 0)) { __libdwfl_seterrno (DWFL_E_LIBELF); return -1; } - for (uint_fast16_t i = 0; result == 0 && i < ehdr_mem.e_phnum; ++i) + for (size_t i = 0; result == 0 && i < phnum; ++i) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); |