Skip to content

Commit 1878787

Browse files
author
Al Viro
committed
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: 5f14596 "alpha: Replace strncmp with str_has_prefix" Signed-off-by: Al Viro <[email protected]>
1 parent e07f68d commit 1878787

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/alpha/boot/tools/objstrip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ main (int argc, char *argv[])
148148
#ifdef __ELF__
149149
elf = (struct elfhdr *) buf;
150150

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) {
152152
if (elf->e_type != ET_EXEC) {
153153
fprintf(stderr, "%s: %s is not an ELF executable\n",
154154
prog_name, inname);

0 commit comments

Comments
 (0)