patch-2.3.99-pre6 linux/fs/exec.c
Next file: linux/fs/ext2/inode.c
Previous file: linux/fs/efs/inode.c
Back to the patch index
Back to the overall index
- Lines: 59
- Date:
Fri Apr 21 13:36:39 2000
- Orig file:
v2.3.99-pre5/linux/fs/exec.c
- Orig date:
Tue Apr 11 15:09:21 2000
diff -u --recursive --new-file v2.3.99-pre5/linux/fs/exec.c linux/fs/exec.c
@@ -315,30 +315,30 @@
return 0;
}
-/* MOUNT_REWRITE: &mnt should be passed to lookup_dentry */
struct file *open_exec(const char *name)
{
- struct dentry *dentry;
- struct vfsmount *mnt = NULL;
+ struct nameidata nd;
struct file *file;
+ int err = 0;
lock_kernel();
- dentry = lookup_dentry(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE);
- file = (struct file*) dentry;
- if (!IS_ERR(dentry)) {
+ if (walk_init(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
+ err = walk_name(name, &nd);
+ file = ERR_PTR(err);
+ if (!err) {
file = ERR_PTR(-EACCES);
- if (S_ISREG(dentry->d_inode->i_mode)) {
- int err = permission(dentry->d_inode, MAY_EXEC);
+ if (S_ISREG(nd.dentry->d_inode->i_mode)) {
+ int err = permission(nd.dentry->d_inode, MAY_EXEC);
file = ERR_PTR(err);
if (!err) {
- file = dentry_open(dentry, mnt, O_RDONLY);
+ file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
out:
unlock_kernel();
return file;
}
}
- dput(dentry);
- mntput(mnt);
+ dput(nd.dentry);
+ mntput(nd.mnt);
}
goto out;
}
@@ -856,6 +856,16 @@
__free_page(bprm.page[i]);
return retval;
+}
+
+void set_binfmt(struct linux_binfmt *new)
+{
+ struct linux_binfmt *old = current->binfmt;
+ if (new && new->module)
+ __MOD_INC_USE_COUNT(new->module);
+ current->binfmt = new;
+ if (old && old->module)
+ __MOD_DEC_USE_COUNT(old->module);
}
int do_coredump(long signr, struct pt_regs * regs)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)