Skip to content

Commit

Permalink
drivers:tty:fix up ENOIOCTLCMD error handling
Browse files Browse the repository at this point in the history
At commit 07d106d, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.
For example:
	fd = open("/dev/tty", O_RDWR);
	ioctl(fd, -1, &argp);

then the errno should be ENOTTY but not EINVAL.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Wanlong Gao authored and Greg Kroah-Hartman committed Sep 5, 2012
1 parent fd7c81f commit bbb63c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2774,7 +2774,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (ld->ops->ioctl) {
retval = ld->ops->ioctl(tty, file, cmd, arg);
if (retval == -ENOIOCTLCMD)
retval = -EINVAL;
retval = -ENOTTY;
}
tty_ldisc_deref(ld);
return retval;
Expand Down

0 comments on commit bbb63c5

Please sign in to comment.