Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/libexec/ld.elf_so/map_object.c,v rcsdiff: /ftp/cvs/cvsroot/src/libexec/ld.elf_so/map_object.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.44 retrieving revision 1.44.2.1 diff -u -p -r1.44 -r1.44.2.1 --- src/libexec/ld.elf_so/map_object.c 2012/07/25 22:51:04 1.44 +++ src/libexec/ld.elf_so/map_object.c 2012/11/20 03:00:46 1.44.2.1 @@ -1,4 +1,4 @@ -/* $NetBSD: map_object.c,v 1.44 2012/07/25 22:51:04 martin Exp $ */ +/* $NetBSD: map_object.c,v 1.44.2.1 2012/11/20 03:00:46 tls Exp $ */ /* * Copyright 1996 John D. Polstra. @@ -34,7 +34,7 @@ #include #ifndef lint -__RCSID("$NetBSD: map_object.c,v 1.44 2012/07/25 22:51:04 martin Exp $"); +__RCSID("$NetBSD: map_object.c,v 1.44.2.1 2012/11/20 03:00:46 tls Exp $"); #endif /* not lint */ #include @@ -105,7 +105,7 @@ _rtld_map_object(const char *path, int f #endif if (sb != NULL && sb->st_size < (off_t)sizeof (Elf_Ehdr)) { - _rtld_error("%s: unrecognized file format1", path); + _rtld_error("%s: not ELF file (too short)", path); return NULL; } @@ -125,9 +125,12 @@ _rtld_map_object(const char *path, int f goto bad; } /* Make sure the file is valid */ - if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 || - ehdr->e_ident[EI_CLASS] != ELFCLASS) { - _rtld_error("%s: unrecognized file format2 [%x != %x]", path, + if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0) { + _rtld_error("%s: not ELF file (magic number bad)", path); + goto bad; + } + if (ehdr->e_ident[EI_CLASS] != ELFCLASS) { + _rtld_error("%s: invalid ELF class %x; expected %x", path, ehdr->e_ident[EI_CLASS], ELFCLASS); goto bad; }