summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_pts.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-02-19 17:54:42 +0000
committered <ed@FreeBSD.org>2009-02-19 17:54:42 +0000
commit092e75386105220cc020aa2239e745cf6a395a20 (patch)
treec38a0414609d397eb0702d2574267121b062b5c6 /sys/kern/tty_pts.c
parentc5cc4a3059f8ca282c58143b3c9e016810b0005d (diff)
downloadFreeBSD-src-092e75386105220cc020aa2239e745cf6a395a20.zip
FreeBSD-src-092e75386105220cc020aa2239e745cf6a395a20.tar.gz
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.
Diffstat (limited to 'sys/kern/tty_pts.c')
-rw-r--r--sys/kern/tty_pts.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c
index 49ea84c..3f8db33 100644
--- a/sys/kern/tty_pts.c
+++ b/sys/kern/tty_pts.c
@@ -290,12 +290,7 @@ ptsdev_ioctl(struct file *fp, u_long cmd, void *data,
/* 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, void *data,
tty_lock(tp);
error = tty_ioctl(tp, cmd, data, td);
tty_unlock(tp);
+ if (error == ENOIOCTL)
+ error = ENOTTY;
return (error);
}
OpenPOWER on IntegriCloud