On Wed, Sep 26, 2007 at 12:58:47AM +0200, Miklos Szeredi wrote:
FYI this whole section might be cleaner as
static int may_mknod(mode_t mode)
{
switch (mode & S_IFMT) {
case S_IFREG:
case S_IFCHR:
case S_IFBLK:
case S_IFFIFO:
case S_IFSOCK:
case 0: /* zero mode translates to S_IFREG *
return 0;
case S_IFDIR:
return -EPERM;
default:
return -EINVAL;
}
}
and then in sys_mknodat just a
error = may_mknod(mode);
if (error)
goto out_dput;
-