Messages in this thread Patch in this message | | | From | Mitsuo Hayasaka <> | Subject | [RFC PATCH] vfs: return EINVAL when calling mknod(2) with S_IFDIR mode | Date | Fri, 03 Feb 2012 14:52:13 +0900 |
| |
According to a manual of mknod(2) and mknodat(2), it seems that they should return EINVAL when called with S_IFDIR mode, although currently they return EPERM. So, this patch changes it to EINVAL for S_IFDIR.
Signed-off-by: Mitsuo Hayasaka <mitsuo.hayasaka.hu@hitachi.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> ---
fs/namei.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c index 208c6aa..5d7ead1 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2483,8 +2483,6 @@ static int may_mknod(umode_t mode) case S_IFSOCK: case 0: /* zero mode translates to S_IFREG */ return 0; - case S_IFDIR: - return -EPERM; default: return -EINVAL; } @@ -2498,7 +2496,7 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode, int error; if (S_ISDIR(mode)) - return -EPERM; + return -EINVAL; dentry = user_path_create(dfd, filename, &path, 0); if (IS_ERR(dentry))
| |