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