summaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/open.c b/fs/open.c
index ac2077f1f..309aa0667 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -103,7 +103,7 @@ static inline long do_sys_truncate(const char * path, loff_t length)
inode = nd.dentry->d_inode;
error = -EACCES;
- if (S_ISDIR(inode->i_mode))
+ if (!S_ISREG(inode->i_mode))
goto dput_and_out;
error = permission(inode,MAY_WRITE);
@@ -164,7 +164,7 @@ static inline long do_sys_ftruncate(unsigned int fd, loff_t length)
dentry = file->f_dentry;
inode = dentry->d_inode;
error = -EACCES;
- if (S_ISDIR(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
+ if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
goto out_putf;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))