X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=fs%2Fopen.c;h=cd0c5be8d01247e8bab3f4e00e6f171803291881;hb=f5c306470ed0a8f03ba7017f397da2555b5800d4;hp=373787afd638009a402b7a56b20372bfbd635706;hpb=56868a460b83c0f93d339256a81064d89aadae8e;p=karo-tx-linux.git diff --git a/fs/open.c b/fs/open.c index 373787afd638..cd0c5be8d012 100644 --- a/fs/open.c +++ b/fs/open.c @@ -193,7 +193,8 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) goto out_putf; error = -EPERM; - if (IS_APPEND(inode)) + /* Check IS_APPEND on real upper inode */ + if (IS_APPEND(file_inode(f.file))) goto out_putf; sb_start_write(inode->i_sb); @@ -459,20 +460,17 @@ out: SYSCALL_DEFINE1(fchdir, unsigned int, fd) { struct fd f = fdget_raw(fd); - struct inode *inode; - int error = -EBADF; + int error; error = -EBADF; if (!f.file) goto out; - inode = file_inode(f.file); - error = -ENOTDIR; - if (!S_ISDIR(inode->i_mode)) + if (!d_can_lookup(f.file->f_path.dentry)) goto out_putf; - error = inode_permission(inode, MAY_EXEC | MAY_CHDIR); + error = inode_permission(file_inode(f.file), MAY_EXEC | MAY_CHDIR); if (!error) set_fs_pwd(current->fs, &f.file->f_path); out_putf: