diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 23:10:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 23:10:00 -0400 |
commit | 7b82dc0e64e93f430182f36b46b79fcee87d3532 (patch) | |
tree | 28c61be85dd899cdb096ac15c65b521b0db60ea8 /fs/open.c | |
parent | 1efd48b3ae8f89a1d04f1e36be96764d7bf43ae9 (diff) |
Remove suid/sgid bits on [f]truncate()
.. to match what we do on write(). This way, people who write to files
by using [f]truncate + writable mmap have the same semantics as if they
were using the write() family of system calls.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -210,6 +210,9 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, | |||
210 | newattrs.ia_valid |= ATTR_FILE; | 210 | newattrs.ia_valid |= ATTR_FILE; |
211 | } | 211 | } |
212 | 212 | ||
213 | /* Remove suid/sgid on truncate too */ | ||
214 | newattrs.ia_valid |= should_remove_suid(dentry); | ||
215 | |||
213 | mutex_lock(&dentry->d_inode->i_mutex); | 216 | mutex_lock(&dentry->d_inode->i_mutex); |
214 | err = notify_change(dentry, &newattrs); | 217 | err = notify_change(dentry, &newattrs); |
215 | mutex_unlock(&dentry->d_inode->i_mutex); | 218 | mutex_unlock(&dentry->d_inode->i_mutex); |