- if (file_read (file, &ehdr, sizeof ehdr) != sizeof ehdr)
- LOAD_ERROR (("error reading executable header"));
- if (memcmp (ehdr.e_ident, "\177ELF\1\1\1", 7) != 0)
- LOAD_ERROR (("file is not ELF"));
- if (ehdr.e_type != 2)
- LOAD_ERROR (("ELF file is not an executable"));
- if (ehdr.e_machine != 3)
- LOAD_ERROR (("ELF executable is not x86"));
- if (ehdr.e_version != 1)
- LOAD_ERROR (("ELF executable hasunknown version %d",
- (int) ehdr.e_version));
- if (ehdr.e_phentsize != sizeof (struct Elf32_Phdr))
- LOAD_ERROR (("bad ELF program header size"));
- if (ehdr.e_phnum > 1024)
- LOAD_ERROR (("too many ELF program headers"));
+ if (file_read (file, &ehdr, sizeof ehdr) != sizeof ehdr
+ || memcmp (ehdr.e_ident, "\177ELF\1\1\1", 7)
+ || ehdr.e_type != 2
+ || ehdr.e_machine != 3
+ || ehdr.e_version != 1
+ || ehdr.e_phentsize != sizeof (struct Elf32_Phdr)
+ || ehdr.e_phnum > 1024)
+ {
+ printf ("load: %s: error loading executable\n", filename);
+ goto done;
+ }