Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 5f14596e55de "alpha: Replace strncmp with str_has_prefix"
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 18787877 e07f68d5

+1 -1
+1 -1
arch/alpha/boot/tools/objstrip.c
··· 148 148 #ifdef __ELF__ 149 149 elf = (struct elfhdr *) buf; 150 150 151 - if (elf->e_ident[0] == 0x7f && str_has_prefix((char *)elf->e_ident + 1, "ELF")) { 151 + if (memcmp(&elf->e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) { 152 152 if (elf->e_type != ET_EXEC) { 153 153 fprintf(stderr, "%s: %s is not an ELF executable\n", 154 154 prog_name, inname);