aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/binfmt_flat.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index b72dc31a0970..108d56bbd0d0 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -442,19 +442,22 @@ static int load_flat_file(struct linux_binprm * bprm,
442 flags = ntohl(hdr->flags); 442 flags = ntohl(hdr->flags);
443 rev = ntohl(hdr->rev); 443 rev = ntohl(hdr->rev);
444 444
445 if (flags & FLAT_FLAG_KTRACE) 445 if (strncmp(hdr->magic, "bFLT", 4)) {
446 printk("BINFMT_FLAT: Loading file: %s\n", bprm->filename);
447
448 if (strncmp(hdr->magic, "bFLT", 4) ||
449 (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION)) {
450 /* 446 /*
451 * because a lot of people do not manage to produce good 447 * because a lot of people do not manage to produce good
452 * flat binaries, we leave this printk to help them realise 448 * flat binaries, we leave this printk to help them realise
453 * the problem. We only print the error if its not a script file 449 * the problem. We only print the error if its not a script file
454 */ 450 */
455 if (strncmp(hdr->magic, "#!", 2)) 451 if (strncmp(hdr->magic, "#!", 2))
456 printk("BINFMT_FLAT: bad magic/rev (0x%x, need 0x%x)\n", 452 printk("BINFMT_FLAT: bad header magic\n");
457 rev, (int) FLAT_VERSION); 453 return -ENOEXEC;
454 }
455
456 if (flags & FLAT_FLAG_KTRACE)
457 printk("BINFMT_FLAT: Loading file: %s\n", bprm->filename);
458
459 if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) {
460 printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION);
458 return -ENOEXEC; 461 return -ENOEXEC;
459 } 462 }
460 463