patch-2.0.4 linux/fs/namei.c
Next file: linux/fs/open.c
Previous file: linux/fs/ext2/super.c
Back to the patch index
Back to the overall index
- Lines: 35
- Date:
Sun Jul 7 20:27:04 1996
- Orig file:
v2.0.3/linux/fs/namei.c
- Orig date:
Wed Jul 3 22:05:18 1996
diff -u --recursive --new-file v2.0.3/linux/fs/namei.c linux/fs/namei.c
@@ -102,6 +102,9 @@
if (inode->i_op && inode->i_op->permission)
return inode->i_op->permission(inode, mask);
+ else if ((mask & S_IWOTH) && IS_RDONLY(inode) &&
+ (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
+ return -EROFS; /* Nobody gets write access to a read-only fs */
else if ((mask & S_IWOTH) && IS_IMMUTABLE(inode))
return -EACCES; /* Nobody gets write access to an immutable file */
else if (current->fsuid == inode->i_uid)
@@ -363,12 +366,12 @@
iput(inode);
error = -EEXIST;
}
- } else if ((error = permission(dir,MAY_WRITE | MAY_EXEC)) != 0)
- ; /* error is already set! */
+ } else if (IS_RDONLY(dir))
+ error = -EROFS;
else if (!dir->i_op || !dir->i_op->create)
error = -EACCES;
- else if (IS_RDONLY(dir))
- error = -EROFS;
+ else if ((error = permission(dir,MAY_WRITE | MAY_EXEC)) != 0)
+ ; /* error is already set! */
else {
dir->i_count++; /* create eats the dir */
if (dir->i_sb && dir->i_sb->dq_op)
@@ -405,6 +408,7 @@
* If there was something like IS_NODEV(inode) for
* pipes and/or sockets I'd check it here.
*/
+ flag &= ~O_TRUNC;
}
else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
if (IS_NODEV(inode)) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov