diff options
Diffstat (limited to 'src/elfops/section-by-name.c')
-rw-r--r-- | src/elfops/section-by-name.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/elfops/section-by-name.c b/src/elfops/section-by-name.c deleted file mode 100644 index 8bb93a3..0000000 --- a/src/elfops/section-by-name.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <string.h> -#include <libelfu/libelfu.h> - - -Elf_Scn* elfu_eScnByName(Elf *e, char *name) -{ - size_t shstrndx; - Elf_Scn *scn; - - if (elf_getshdrstrndx(e, &shstrndx) != 0) { - return NULL; - } - - scn = elf_getscn(e, 1); - while (scn) { - GElf_Shdr shdr; - char *curname; - - if (gelf_getshdr(scn, &shdr) != &shdr) { - return NULL; - } - - /* elf_strptr returns NULL if there was an error */ - curname = elf_strptr(e, shstrndx, shdr.sh_name); - - /* strcmp... but we really have no bounds on the lengths here */ - if (!strcmp(curname, name)) { - return scn; - } - - scn = elf_nextscn(e, scn); - } - - return NULL; -} |