svn commit: r188822 - head/sys/kern

Ed Schouten ed at FreeBSD.org
Thu Feb 19 09:54:43 PST 2009


Author: ed
Date: Thu Feb 19 17:54:42 2009
New Revision: 188822
URL: http://svn.freebsd.org/changeset/base/188822

Log:
  Squash some small bugs in pts(4).
  
  - Don't return a negative errno when using an unknown ioctl() on a
    pseudo-terminal master device. Be sure to convert ENOIOCTL to ENOTTY,
    just like the TTY layer does.
  
  - Even though we should return st_rdev of the master device node when
    emulating pty(4) devices, FIODGNAME should still return the name of
    the slave device. Otherwise ptsname(3) and ttyname(3) return an
    invalid device name.

Modified:
  head/sys/kern/tty_pts.c

Modified: head/sys/kern/tty_pts.c
==============================================================================
--- head/sys/kern/tty_pts.c	Thu Feb 19 17:44:23 2009	(r188821)
+++ head/sys/kern/tty_pts.c	Thu Feb 19 17:54:42 2009	(r188822)
@@ -290,12 +290,7 @@ ptsdev_ioctl(struct file *fp, u_long cmd
 
 		/* Reverse device name lookups, for ptsname() and ttyname(). */
 		fgn = data;
-#ifdef PTS_EXTERNAL
-		if (psc->pts_cdev != NULL)
-			p = devtoname(psc->pts_cdev);
-		else
-#endif /* PTS_EXTERNAL */
-			p = tty_devname(tp);
+		p = tty_devname(tp);
 		i = strlen(p) + 1;
 		if (i > fgn->len)
 			return (EINVAL);
@@ -385,6 +380,8 @@ ptsdev_ioctl(struct file *fp, u_long cmd
 	tty_lock(tp);
 	error = tty_ioctl(tp, cmd, data, td);
 	tty_unlock(tp);
+	if (error == ENOIOCTL)
+		error = ENOTTY;
 
 	return (error);
 }


More information about the svn-src-all mailing list