patch-2.1.60 linux/fs/binfmt_aout.c

Next file: linux/fs/binfmt_elf.c
Previous file: linux/fs/autofs/waitq.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.59/linux/fs/binfmt_aout.c linux/fs/binfmt_aout.c
@@ -58,7 +58,7 @@
  * macros to write out all the necessary info.
  */
 #define DUMP_WRITE(addr,nr) \
-while (file.f_op->write(inode,&file,(char *)(addr),(nr)) != (nr)) goto close_coredump
+while (file.f_op->write(&file,(char *)(addr),(nr),&file.f_pos) != (nr)) goto close_coredump
 
 #define DUMP_SEEK(offset) \
 if (file.f_op->llseek) { \
@@ -306,6 +306,7 @@
 	unsigned long p = bprm->p;
 	unsigned long fd_offset;
 	unsigned long rlim;
+	int retval;
 
 	ex = *((struct exec *) bprm->buf);		/* exec-header */
 	if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC &&
@@ -341,8 +342,12 @@
 	if (ex.a_data + ex.a_bss > rlim)
 		return -ENOMEM;
 
+	/* Flush all traces of the currently running executable */
+	retval = flush_old_exec(bprm);
+	if (retval)
+		return retval;
+
 	/* OK, This is the point of no return */
-	flush_old_exec(bprm);
 #ifdef __sparc__
 	memcpy(&current->tss.core_exec, &ex, sizeof(struct exec));
 #endif
@@ -498,7 +503,7 @@
 		file->f_pos = 0;
 
 	set_fs(KERNEL_DS);
-	error = file->f_op->read(inode, file, (char *) &ex, sizeof(ex));
+	error = file->f_op->read(file, (char *) &ex, sizeof(ex), &file->f_pos);
 	set_fs(USER_DS);
 	if (error != sizeof(ex))
 		return -ENOEXEC;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov