summaryrefslogtreecommitdiffstats
path: root/src/readelf.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2009-01-22 19:55:00 -0800
committerRoland McGrath <[email protected]>2009-01-22 19:55:00 -0800
commit9a847e148b6aa52aae172b9bbf354ae89df8e0d3 (patch)
tree7225cdb6410aa4fde71dabebb1dcc504f6ddab2f /src/readelf.c
parentd759aa6df852e7776ab94eeee71a27989a11688b (diff)
readelf -l: Don't print section mapping when no sections.
Diffstat (limited to 'src/readelf.c')
-rw-r--r--src/readelf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/readelf.c b/src/readelf.c
index fc2abfc3..d5a3b8d4 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -976,6 +976,10 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr)
}
}
+ if (ehdr->e_shnum == 0)
+ /* No sections in the file. Punt. */
+ return;
+
/* Get the section header string table index. */
size_t shstrndx;
if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))