On Jul 5 2007 15:43, Dave Hansen wrote:
>@@ -1911,13 +1911,27 @@ asmlinkage long sys_mknodat(int dfd, con
> error = do_path_lookup(dfd, tmp, LOOKUP_PARENT, &nd);
> if (error)
> goto out;
>+
> dentry = lookup_create(&nd, 0);
> error = PTR_ERR(dentry);
>+ if (error)
>+ goto out_unlock;
>
> if (!IS_POSIXACL(nd.dentry->d_inode))
> mode &= ~current->fs->umask;
>- if (!IS_ERR(dentry)) {
>- switch (mode & S_IFMT) {
>+ if (S_ISDIR(mode)) {
>+ error = -EPERM;
>+ goto out_dput;
Hm, I wonder why mknod(,S_IFDIR,) returns -EPERM rather than -EINVAL like the
others? It is a bit misleading; EPERM usually means root could do it
somehow (unless the kernel is really pedantic).
IMHO this if(S_ISDIR) should go.
>+ if (!S_ISREG(mode) && !S_ISCHR(mode) && !S_ISBLK(mode) &&
>+ !S_ISFIFO(mode) && !S_ISSOCK(mode) && (mode != 0)) {
If you align the two &&s (^) you can also align ^ the others :)
>+ error = -EINVAL;
>+ goto out_dput;
>+ }
Jan
--
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html