patch-2.3.99-pre6 linux/fs/binfmt_aout.c
Next file: linux/fs/binfmt_elf.c
Previous file: linux/fs/bfs/file.c
Back to the patch index
Back to the overall index
- Lines: 77
- Date:
Thu Apr 13 08:11:48 2000
- Orig file:
v2.3.99-pre5/linux/fs/binfmt_aout.c
- Orig date:
Mon Mar 27 08:08:29 2000
diff -u --recursive --new-file v2.3.99-pre5/linux/fs/binfmt_aout.c linux/fs/binfmt_aout.c
@@ -252,7 +252,6 @@
static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
{
struct exec ex;
- int fd;
unsigned long error;
unsigned long fd_offset;
unsigned long rlim;
@@ -284,11 +283,14 @@
return retval;
/* OK, This is the point of no return */
- current->personality = PER_LINUX;
-
-#if defined(__sparc__) && !defined(__sparc_v9__)
+#if !defined(__sparc__)
+ set_personality(PER_LINUX);
+#else
+ set_personality(PER_SUNOS);
+#if !defined(__sparc_v9__)
memcpy(¤t->thread.core_exec, &ex, sizeof(struct exec));
#endif
+#endif
current->mm->end_code = ex.a_text +
(current->mm->start_code = N_TXTADDR(ex));
@@ -341,12 +343,6 @@
error_time2 = jiffies;
}
- fd = get_unused_fd();
- if (fd < 0)
- return fd;
- get_file(bprm->file);
- fd_install(fd, bprm->file);
-
if ((fd_offset & ~PAGE_MASK) != 0 &&
(jiffies-error_time) > 5*HZ)
{
@@ -358,7 +354,6 @@
if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) {
loff_t pos = fd_offset;
- sys_close(fd);
do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex),
ex.a_text+ex.a_data, &pos);
@@ -374,7 +369,6 @@
fd_offset);
if (error != N_TXTADDR(ex)) {
- sys_close(fd);
send_sig(SIGKILL, current, 0);
return error;
}
@@ -383,20 +377,13 @@
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
fd_offset + ex.a_text);
- sys_close(fd);
if (error != N_DATADDR(ex)) {
send_sig(SIGKILL, current, 0);
return error;
}
}
beyond_if:
- put_exec_domain(current->exec_domain);
- if (current->binfmt && current->binfmt->module)
- __MOD_DEC_USE_COUNT(current->binfmt->module);
- current->exec_domain = lookup_exec_domain(current->personality);
- current->binfmt = &aout_format;
- if (current->binfmt && current->binfmt->module)
- __MOD_INC_USE_COUNT(current->binfmt->module);
+ set_binfmt(&aout_format);
set_brk(current->mm->start_brk, current->mm->brk);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)