[PATCH][2.6.10-rc3-mm1] ioctl cleanups broke FIONREAD et al
From: Mikael Pettersson
Date: Mon Dec 13 2004 - 08:58:20 EST
The ioctl-cleanup.patch in 2.6.10-rc3-mm1 broke the file
ioctls: FIONREAD etc. These ioctls have inline code for
S_ISREG() cases, but should be redirected to ->ioctl() for
other cases. ioctl-cleanup.patch removed that redirection.
For me, both emacs and X refused to start from a console with
ENOTTY errors; at least emacs got the ENOTTY from FIONREAD.
The patch below should fix the problem.
/Mikael
--- linux-2.6.10-rc3-mm1/fs/ioctl.c.~1~ 2004-12-13 13:05:09.000000000 +0100
+++ linux-2.6.10-rc3-mm1/fs/ioctl.c 2004-12-13 14:35:00.000000000 +0100
@@ -93,10 +93,8 @@ asmlinkage long sys_ioctl(unsigned int f
int block;
int res;
- if (!S_ISREG(inode->i_mode)) {
- error = -ENOTTY;
- goto done;
- }
+ if (!S_ISREG(inode->i_mode))
+ break;
/* do we support this mess? */
if (!mapping->a_ops->bmap) {
error = -EINVAL;
@@ -116,19 +114,15 @@ asmlinkage long sys_ioctl(unsigned int f
goto done;
}
case FIGETBSZ:
- if (!S_ISREG(inode->i_mode)) {
- error = -ENOTTY;
- goto done;
- }
+ if (!S_ISREG(inode->i_mode))
+ break;
error = -EBADF;
if (inode->i_sb)
error = put_user(inode->i_sb->s_blocksize, p);
goto done;
case FIONREAD:
- if (!S_ISREG(inode->i_mode)) {
- error = -ENOTTY;
- goto done;
- }
+ if (!S_ISREG(inode->i_mode))
+ break;
error = put_user(i_size_read(inode) - filp->f_pos, p);
goto done;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/