svn commit: r225506 - head/sys/kern

Ed Schouten ed at FreeBSD.org
Mon Sep 12 10:07:21 UTC 2011


Author: ed
Date: Mon Sep 12 10:07:21 2011
New Revision: 225506
URL: http://svn.freebsd.org/changeset/base/225506

Log:
  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@)

Modified:
  head/sys/kern/tty.c

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c	Mon Sep 12 08:38:21 2011	(r225505)
+++ head/sys/kern/tty.c	Mon Sep 12 10:07:21 2011	(r225506)
@@ -766,7 +766,7 @@ ttyil_ioctl(struct cdev *dev, u_long cmd
     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
 	error = ttydevsw_cioctl(tp, dev2unit(dev), cmd, data, td);
 	if (error != ENOIOCTL)
 		goto done;
+	error = 0;
 
 	switch (cmd) {
 	case TIOCGETA:


More information about the svn-src-head mailing list