Return ENOEXEC instead of ENOENT if an ELF binary's interpreter doesn't exist. If you try to execute a binary compiled for ld-linux.so.1 (libc5) on a machine with only ld-linux.so.2 (libc6), your shell will claim "mybinary: No such file or directory", even though the binary exists. The ENOENT actually applies to the ELF intepreter, not to the file itself. This patch causes it to give a more helpful and more expected error, "cannot execute binary file". Signed-off-by: Geoffrey Thomas Tested-by: Anders Kaseorg --- linux-2.6/fs/binfmt_elf.c 2009-02-22 22:13:44.000000000 -0500 +++ linux-2.6/fs/binfmt_elf.c 2009-03-03 23:02:51.392456503 -0500 @@ -699,8 +699,11 @@ interpreter = open_exec(elf_interpreter); retval = PTR_ERR(interpreter); - if (IS_ERR(interpreter)) + if (IS_ERR(interpreter)) { + if (retval == -ENOENT) + retval = -ENOEXEC; goto out_free_interp; + } /* * If the binary is not readable then enforce