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.
This commit is contained in:
parent
24a07b5b23
commit
40d05103d8
@ -290,11 +290,6 @@ 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);
|
||||
i = strlen(p) + 1;
|
||||
if (i > fgn->len)
|
||||
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user