Simplify includes
[centaur.git] / src / elfops / section-name.c
1 #include <stdlib.h>
2 #include <libelfu/libelfu.h>
3
4
5 char* elfu_eScnName(Elf *e, Elf_Scn *scn)
6 {
7   size_t shstrndx;
8   GElf_Shdr shdr;
9
10   if (elf_getshdrstrndx(e, &shstrndx) != 0) {
11     return NULL;
12   }
13
14   if (gelf_getshdr(scn, &shdr) != &shdr) {
15     return NULL;
16   }
17
18   /* elf_strptr returns NULL if there was an error */
19   return elf_strptr(e, shstrndx, shdr.sh_name);
20 }