svn commit: r188822 - head/sys/kern

[ Available lists | Index of svn-src-head | Month of Feb 2009 | Week of 19 Feb 2009 | Raw email | View thread | Wrap long lines | Reply ]
From
Ed Schouten <ed@FreeBSD.org>
Date
19 Feb 2009 17:54:43
Subject
svn commit: r188822 - head/sys/kern
Message-ID
200902191754.n1JHsgar003995@svn.freebsd.org


[ Hide this part ]
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);
}


Elapsed time: 0.093 seconds