patch-2.4.7 linux/fs/namei.c
Next file: linux/fs/nfs/nfsroot.c
Previous file: linux/fs/locks.c
Back to the patch index
Back to the overall index
- Lines: 67
- Date:
Fri Jul 20 12:39:56 2001
- Orig file:
v2.4.6/linux/fs/namei.c
- Orig date:
Tue Jul 3 17:08:21 2001
diff -u --recursive --new-file v2.4.6/linux/fs/namei.c linux/fs/namei.c
@@ -886,7 +886,7 @@
{
int error;
- mode &= S_IALLUGO & ~current->fs->umask;
+ mode &= S_IALLUGO;
mode |= S_IFREG;
down(&dir->i_zombie);
@@ -975,7 +975,8 @@
/* Negative dentry, just create the file */
if (!dentry->d_inode) {
- error = vfs_create(dir->d_inode, dentry, mode);
+ error = vfs_create(dir->d_inode, dentry,
+ mode & ~current->fs->umask);
up(&dir->d_inode->i_sem);
dput(nd->dentry);
nd->dentry = dentry;
@@ -1164,8 +1165,6 @@
{
int error = -EPERM;
- mode &= ~current->fs->umask;
-
down(&dir->i_zombie);
if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
goto exit_lock;
@@ -1208,6 +1207,8 @@
goto out;
dentry = lookup_create(&nd, 0);
error = PTR_ERR(dentry);
+
+ mode &= ~current->fs->umask;
if (!IS_ERR(dentry)) {
switch (mode & S_IFMT) {
case 0: case S_IFREG:
@@ -1246,7 +1247,7 @@
goto exit_lock;
DQUOT_INIT(dir);
- mode &= (S_IRWXUGO|S_ISVTX) & ~current->fs->umask;
+ mode &= (S_IRWXUGO|S_ISVTX);
lock_kernel();
error = dir->i_op->mkdir(dir, dentry, mode);
unlock_kernel();
@@ -1276,7 +1277,8 @@
dentry = lookup_create(&nd, 1);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
- error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
+ error = vfs_mkdir(nd.dentry->d_inode, dentry,
+ mode & ~current->fs->umask);
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
@@ -1685,6 +1687,10 @@
down(&old_dir->i_sb->s_vfs_rename_sem);
error = -EINVAL;
if (is_subdir(new_dentry, old_dentry))
+ goto out_unlock;
+ /* Don't eat your daddy, dear... */
+ /* This also avoids locking issues */
+ if (old_dentry->d_parent == new_dentry)
goto out_unlock;
target = new_dentry->d_inode;
if (target) { /* Hastur! Hastur! Hastur! */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)