lkml.org 
[lkml]   [2012]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH] vfs: return EINVAL when calling mknod(2) with S_IFDIR mode
Date
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))


\
 
 \ /
  Last update: 2012-02-03 06:49    [W:0.021 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site