summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWez Furlong <wez@messagesystems.com>2012-03-24 10:08:46 -0400
committerWez Furlong <wez@messagesystems.com>2012-03-24 10:08:46 -0400
commit360c8b9c5c6424c753131c7253da393fa6aab71f (patch)
tree21fe593b8d8af02f6c9b9ee466feff85983e42fb
parent729f57f084156849c553ee494c9492fb966c4a3a (diff)
downloadctf-360c8b9c5c6424c753131c7253da393fa6aab71f.tar.gz
fix operation on Linux, where the deprecated elf_getshstrndx API simply
returns the value from elf_getshdrstrndx, which is 0 in my simple test case, and is interpreted as an error. Switch to the newer API and check for the definitive -1 value as the error indicator.
-rw-r--r--libdwarf/dwarf_init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libdwarf/dwarf_init.c b/libdwarf/dwarf_init.c
index 8fd5761..7749345 100644
--- a/libdwarf/dwarf_init.c
+++ b/libdwarf/dwarf_init.c
@@ -610,7 +610,7 @@ dwarf_elf_read(Dwarf_Debug dbg, Dwarf_Error *error)
}
/* Get the section index to the string table. */
- if (elf_getshstrndx(dbg->dbg_elf, &dbg->dbg_stnum) == 0) {
+ if (elf_getshdrstrndx(dbg->dbg_elf, &dbg->dbg_stnum) == -1) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ELF;
}