提交 050ac841 编写于 作者: M Miklos Szeredi 提交者: Al Viro

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: NMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 af2f5542
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册