Commit 741b7c3f authored by Al Viro's avatar Al Viro

path_init(): make -ENOTDIR failure exits consistent

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 582aa64a
...@@ -1859,7 +1859,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, ...@@ -1859,7 +1859,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,
if (flags & LOOKUP_ROOT) { if (flags & LOOKUP_ROOT) {
struct inode *inode = nd->root.dentry->d_inode; struct inode *inode = nd->root.dentry->d_inode;
if (*name) { if (*name) {
if (!inode->i_op->lookup) if (!can_lookup(inode))
return -ENOTDIR; return -ENOTDIR;
retval = inode_permission(inode, MAY_EXEC); retval = inode_permission(inode, MAY_EXEC);
if (retval) if (retval)
...@@ -1913,7 +1913,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, ...@@ -1913,7 +1913,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,
dentry = f.file->f_path.dentry; dentry = f.file->f_path.dentry;
if (*name) { if (*name) {
if (!S_ISDIR(dentry->d_inode->i_mode)) { if (!can_lookup(dentry->d_inode)) {
fdput(f); fdput(f);
return -ENOTDIR; return -ENOTDIR;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment