6 #include <libelfu/libelfu.h>
9 Elf_Scn* elfu_sectionByName(Elf *e, char *name)
14 if (elf_getshdrstrndx(e, &shstrndx) != 0) {
18 scn = elf_getscn(e, 1);
23 if (gelf_getshdr(scn, &shdr) != &shdr) {
27 /* elf_strptr returns NULL if there was an error */
28 curname = elf_strptr(e, shstrndx, shdr.sh_name);
30 /* strcmp... but we really have no bounds on the lengths here */
31 if (!strcmp(curname, name)) {
35 scn = elf_nextscn(e, scn);