patch-1.3.52 linux/fs/namei.c
Next file: linux/fs/open.c
Previous file: linux/fs/exec.c
Back to the patch index
Back to the overall index
- Lines: 33
- Date:
Fri Dec 29 14:47:42 1995
- Orig file:
v1.3.51/linux/fs/namei.c
- Orig date:
Sun Dec 17 11:43:20 1995
diff -u --recursive --new-file v1.3.51/linux/fs/namei.c linux/fs/namei.c
@@ -416,28 +416,19 @@
return -EPERM;
}
if (flag & O_TRUNC) {
- struct iattr newattrs;
-
if ((error = get_write_access(inode))) {
iput(inode);
return error;
}
if (inode->i_sb && inode->i_sb->dq_op)
inode->i_sb->dq_op->initialize(inode, -1);
- newattrs.ia_size = 0;
- newattrs.ia_valid = ATTR_SIZE;
- if ((error = notify_change(inode, &newattrs))) {
- put_write_access(inode);
+
+ error = do_truncate(inode, 0);
+ put_write_access(inode);
+ if (error) {
iput(inode);
return error;
}
- down(&inode->i_sem);
- inode->i_size = 0;
- if (inode->i_op && inode->i_op->truncate)
- inode->i_op->truncate(inode);
- up(&inode->i_sem);
- inode->i_dirt = 1;
- put_write_access(inode);
} else
if (flag & FMODE_WRITE)
if (inode->i_sb && inode->i_sb->dq_op)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this