Commit 18787877 authored by Al Viro's avatar Al Viro

alpha/boot/tools/objstrip: fix the check for ELF header

Just memcmp() with ELFMAG - that's the normal way to do it in userland
code, which that thing is.  Besides, that has the benefit of actually
building - str_has_prefix() is *NOT* present in <string.h>.

Fixes: 5f14596e "alpha: Replace strncmp with str_has_prefix"
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent e07f68d5
...@@ -148,7 +148,7 @@ main (int argc, char *argv[]) ...@@ -148,7 +148,7 @@ main (int argc, char *argv[])
#ifdef __ELF__ #ifdef __ELF__
elf = (struct elfhdr *) buf; elf = (struct elfhdr *) buf;
if (elf->e_ident[0] == 0x7f && str_has_prefix((char *)elf->e_ident + 1, "ELF")) { if (memcmp(&elf->e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) {
if (elf->e_type != ET_EXEC) { if (elf->e_type != ET_EXEC) {
fprintf(stderr, "%s: %s is not an ELF executable\n", fprintf(stderr, "%s: %s is not an ELF executable\n",
prog_name, inname); prog_name, inname);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment