patch-2.0.1 linux/fs/open.c
Next file: linux/fs/pipe.c
Previous file: linux/fs/nfs/proc.c
Back to the patch index
Back to the overall index
- Lines: 56
- Date:
Tue Jul 2 19:08:42 1996
- Orig file:
v2.0.0/linux/fs/open.c
- Orig date:
Tue May 28 08:09:56 1996
diff -u --recursive --new-file v2.0.0/linux/fs/open.c linux/fs/open.c
@@ -53,6 +53,8 @@
return -EBADF;
if (!(inode = file->f_inode))
return -ENOENT;
+ if (!inode->i_sb)
+ return -ENODEV;
if (!inode->i_sb->s_op->statfs)
return -ENOSYS;
inode->i_sb->s_op->statfs(inode->i_sb, buf, sizeof(struct statfs));
@@ -397,7 +399,7 @@
/*
* If the owner has been changed, remove the setuid bit
*/
- if (user != inode->i_uid && (inode->i_mode & S_ISUID)) {
+ if (inode->i_mode & S_ISUID) {
newattrs.ia_mode &= ~S_ISUID;
newattrs.ia_valid |= ATTR_MODE;
}
@@ -407,8 +409,7 @@
* Don't remove the setgid bit if no group execute bit.
* This is a file marked for mandatory locking.
*/
- if (group != inode->i_gid &&
- ((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))) {
+ if (((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))) {
newattrs.ia_mode &= ~S_ISGID;
newattrs.ia_valid |= ATTR_MODE;
}
@@ -453,7 +454,7 @@
/*
* If the owner has been changed, remove the setuid bit
*/
- if (user != inode->i_uid && (inode->i_mode & S_ISUID)) {
+ if (inode->i_mode & S_ISUID) {
newattrs.ia_mode &= ~S_ISUID;
newattrs.ia_valid |= ATTR_MODE;
}
@@ -463,8 +464,7 @@
* Don't remove the setgid bit if no group execute bit.
* This is a file marked for mandatory locking.
*/
- if (group != inode->i_gid &&
- ((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))) {
+ if (((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))) {
newattrs.ia_mode &= ~S_ISGID;
newattrs.ia_valid |= ATTR_MODE;
}
@@ -509,7 +509,7 @@
f->f_mode = (flag+1) & O_ACCMODE;
if (f->f_mode)
flag++;
- if (flag & (O_TRUNC | O_CREAT))
+ if (flag & O_TRUNC)
flag |= 2;
error = open_namei(filename,flag,mode,&inode,NULL);
if (error)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov