linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][2.6.10-rc3-mm1] ioctl cleanups broke FIONREAD et al
@ 2004-12-13 13:56 Mikael Pettersson
  0 siblings, 0 replies; only message in thread
From: Mikael Pettersson @ 2004-12-13 13:56 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

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;
 	}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-13 13:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-13 13:56 [PATCH][2.6.10-rc3-mm1] ioctl cleanups broke FIONREAD et al Mikael Pettersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).