patch-1.3.78 linux/fs/binfmt_script.c

Next file: linux/fs/dcache.c
Previous file: linux/drivers/sound/sscape.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.77/linux/fs/binfmt_script.c linux/fs/binfmt_script.c
@@ -13,8 +13,8 @@
 
 static int do_load_script(struct linux_binprm *bprm,struct pt_regs *regs)
 {
-	char *cp, *interp, *i_name, *i_arg, *page;
-	int retval, offset;
+	char *cp, *interp, *i_name, *i_arg;
+	int retval;
 	if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || (bprm->sh_bang)) 
 		return -ENOEXEC;
 	/*
@@ -60,16 +60,7 @@
 	 * This is done in reverse order, because of how the
 	 * user environment and arguments are stored.
 	 */
-	if (bprm->argc) {
-		offset = bprm->p % PAGE_SIZE;
-		page = (char*)bprm->page[bprm->p/PAGE_SIZE];
-		while(bprm->p++,*(page+offset++))
-			if(offset==PAGE_SIZE){
-				offset=0;
-				page = (char*)bprm->page[bprm->p/PAGE_SIZE];
-			}
-		bprm->argc--;
-	}
+	remove_arg_zero(bprm);
 	bprm->p = copy_strings(1, &bprm->filename, bprm->page, bprm->p, 2);
 	bprm->argc++;
 	if (i_arg) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this