diff options
author | ed <ed@FreeBSD.org> | 2011-09-12 10:07:21 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2011-09-12 10:07:21 +0000 |
commit | 5ccb03a60fb53e56e1f4941122c00f4bb207cf02 (patch) | |
tree | 6192f70730316bf7c530beefad8c5bbc57c12b6a /sys/kern/tty.c | |
parent | 3174e1aa42c0aaec8c53ca03a7c0e4a5a579d33c (diff) | |
download | FreeBSD-src-5ccb03a60fb53e56e1f4941122c00f4bb207cf02.zip FreeBSD-src-5ccb03a60fb53e56e1f4941122c00f4bb207cf02.tar.gz |
Fix error return codes for ioctls on init/lock state devices.
In revision 223722 we introduced support for driver ioctls on init/lock
state devices. Unfortunately the call to ttydevsw_cioctl() clobbers the
value of the error variable, meaning that in many cases ioctl() will now
return ENOTTY, even though the ioctl() was processed properly.
Reported by: Boris Samorodov <bsam ipt ru>
Patch by: jilles@
Approved by: re@ (kib@)
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r-- | sys/kern/tty.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index ce49f972..b5fcba9 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -766,7 +766,7 @@ ttyil_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { struct tty *tp = dev->si_drv1; - int error = 0; + int error; tty_lock(tp); if (tty_gone(tp)) { @@ -777,6 +777,7 @@ ttyil_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, error = ttydevsw_cioctl(tp, dev2unit(dev), cmd, data, td); if (error != ENOIOCTL) goto done; + error = 0; switch (cmd) { case TIOCGETA: |