summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-05-21 17:30:12 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2012-06-01 12:11:59 -0400
commit050ac841ea90610067fec26150574be8c6077738 (patch)
tree9cad4c8ddc28fc4d22715c6a72ade663a5063815 /fs
parentaf2f55426d1d888dcc0ba8dc9e9deb49fae38e38 (diff)
downloadlinux-050ac841ea90610067fec26150574be8c6077738.tar.bz2
vfs: do_last(): only return EISDIR for O_CREAT
This allows this code to be shared between O_CREAT and plain opens. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 4767c0588b6e..90210b46b461 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2384,7 +2384,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
if (error)
return ERR_PTR(error);
error = -EISDIR;
- if (S_ISDIR(nd->inode->i_mode))
+ if ((open_flag & O_CREAT) && S_ISDIR(nd->inode->i_mode))
goto exit;
error = -ENOTDIR;
if ((nd->flags & LOOKUP_DIRECTORY) && !nd->inode->i_op->lookup)