aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_script.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_script.c')
-rw-r--r--fs/binfmt_script.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
index d3b8c1f63155..5027a3e14922 100644
--- a/fs/binfmt_script.c
+++ b/fs/binfmt_script.c
@@ -14,7 +14,7 @@
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16 16
17static int load_script(struct linux_binprm *bprm,struct pt_regs *regs) 17static int load_script(struct linux_binprm *bprm)
18{ 18{
19 const char *i_arg, *i_name; 19 const char *i_arg, *i_name;
20 char *cp; 20 char *cp;
@@ -22,15 +22,13 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
22 char interp[BINPRM_BUF_SIZE]; 22 char interp[BINPRM_BUF_SIZE];
23 int retval; 23 int retval;
24 24
25 if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || 25 if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!'))
26 (bprm->recursion_depth > BINPRM_MAX_RECURSION))
27 return -ENOEXEC; 26 return -ENOEXEC;
28 /* 27 /*
29 * This section does the #! interpretation. 28 * This section does the #! interpretation.
30 * Sorta complicated, but hopefully it will work. -TYT 29 * Sorta complicated, but hopefully it will work. -TYT
31 */ 30 */
32 31
33 bprm->recursion_depth++;
34 allow_write_access(bprm->file); 32 allow_write_access(bprm->file);
35 fput(bprm->file); 33 fput(bprm->file);
36 bprm->file = NULL; 34 bprm->file = NULL;
@@ -82,7 +80,9 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
82 retval = copy_strings_kernel(1, &i_name, bprm); 80 retval = copy_strings_kernel(1, &i_name, bprm);
83 if (retval) return retval; 81 if (retval) return retval;
84 bprm->argc++; 82 bprm->argc++;
85 bprm->interp = interp; 83 retval = bprm_change_interp(interp, bprm);
84 if (retval < 0)
85 return retval;
86 86
87 /* 87 /*
88 * OK, now restart the process with the interpreter's dentry. 88 * OK, now restart the process with the interpreter's dentry.
@@ -95,7 +95,7 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
95 retval = prepare_binprm(bprm); 95 retval = prepare_binprm(bprm);
96 if (retval < 0) 96 if (retval < 0)
97 return retval; 97 return retval;
98 return search_binary_handler(bprm,regs); 98 return search_binary_handler(bprm);
99} 99}
100 100
101static struct linux_binfmt script_format = { 101static struct linux_binfmt script_format = {