Skip to content

Commit

Permalink
path_init(): make -ENOTDIR failure exits consistent
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Dec 20, 2012
1 parent 582aa64 commit 741b7c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,
if (flags & LOOKUP_ROOT) {
struct inode *inode = nd->root.dentry->d_inode;
if (*name) {
if (!inode->i_op->lookup)
if (!can_lookup(inode))
return -ENOTDIR;
retval = inode_permission(inode, MAY_EXEC);
if (retval)
Expand Down Expand Up @@ -1913,7 +1913,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,
dentry = f.file->f_path.dentry;

if (*name) {
if (!S_ISDIR(dentry->d_inode->i_mode)) {
if (!can_lookup(dentry->d_inode)) {
fdput(f);
return -ENOTDIR;
}
Expand Down

0 comments on commit 741b7c3

Please sign in to comment.