summaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-04-05 11:23:36 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-04-05 11:23:36 +0000
commit4318fbda2a7ee51caafdc4eb1f8028a3f0605142 (patch)
treecddb50a81d7d1a628cc400519162080c6d87868e /fs/exec.c
parent36ea5120664550fae6d31f1c6f695e4f8975cb06 (diff)
o Merge with Linux 2.1.91.
o First round of bugfixes for the SC/MC CPUs. o FPU context switch fixes. o Lazy context switches. o Faster syscalls. o Removed dead code. o Shitloads of other things I forgot ...
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/exec.c b/fs/exec.c
index c3d420973..f67c028ff 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -142,10 +142,9 @@ int unregister_binfmt(struct linux_binfmt * fmt)
/* N.B. Error returns must be < 0 */
int open_dentry(struct dentry * dentry, int mode)
{
- int fd;
struct inode * inode = dentry->d_inode;
struct file * f;
- int error;
+ int fd, error;
error = -EINVAL;
if (!inode->i_op || !inode->i_op->default_file_ops)
@@ -167,7 +166,7 @@ int open_dentry(struct dentry * dentry, int mode)
if (error)
goto out_filp;
}
- current->files->fd[fd] = f;
+ fd_install(fd, f);
dget(dentry);
}
return fd;
@@ -199,18 +198,20 @@ asmlinkage int sys_uselib(const char * library)
retval = fd;
if (fd < 0)
goto out;
- file = current->files->fd[fd];
+ file = fget(fd);
retval = -ENOEXEC;
if (file && file->f_dentry && file->f_op && file->f_op->read) {
for (fmt = formats ; fmt ; fmt = fmt->next) {
int (*fn)(int) = fmt->load_shlib;
if (!fn)
continue;
+ /* N.B. Should use file instead of fd */
retval = fn(fd);
if (retval != -ENOEXEC)
break;
}
}
+ fput(file);
sys_close(fd);
out:
unlock_kernel();
@@ -495,7 +496,7 @@ static inline void flush_old_files(struct files_struct * files)
unsigned long set, i;
i = j * __NFDBITS;
- if (i >= NR_OPEN)
+ if (i >= files->max_fds)
break;
set = files->close_on_exec.fds_bits[j];
files->close_on_exec.fds_bits[j] = 0;