zdump: df_elf: read_elf_hdr: return Elf64_Ehdr struct

This makes the API of `read_elf_hdr` consistent with `read_elf_phdrs`.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2022-04-11 14:26:41 +02:00
committed by Jan Höppner
parent 4e6d43e2ac
commit f93f437f8b
3 changed files with 25 additions and 16 deletions
+5 -3
View File
@@ -52,15 +52,17 @@ bool ehdr_is_s390x(const Elf64_Ehdr *ehdr)
ehdr->e_ident[EI_CLASS] == ELFCLASS64;
}
int read_elf_hdr(const struct zg_fh *fh, Elf64_Ehdr *ehdr)
Elf64_Ehdr *read_elf_hdr(const struct zg_fh *fh)
{
Elf64_Ehdr *ehdr;
const size_t ehdr_size = sizeof(*ehdr);
if (zg_size(fh) < ehdr_size)
return -1;
return NULL;
ehdr = util_malloc(ehdr_size);
zg_read(fh, ehdr, ehdr_size, ZG_CHECK);
return 0;
return ehdr;
}
Elf64_Phdr *read_elf_phdrs(const struct zg_fh *fh, const Elf64_Ehdr *ehdr, unsigned int *phdr_count)