In rev. 1.156, the convertion of the minor number to the unit number

resulted in the argument to the make_dev() to be a unit number.

Correct this by supplying a minor number to make_dev(), and using
the unit number for the calculation of the slave tty name.

Reported and tested by:	Peter Holm
Reviewed by:	jhb
Yet another pointy hat to:	kib
MFC after:	1 day
This commit is contained in:
Konstantin Belousov 2008-01-26 06:09:23 +00:00
parent a4fcb5ec11
commit 58145c6aa2

View File

@ -157,12 +157,14 @@ ptyinit(struct cdev *devc, struct thread *td)
}
static void
pty_create_slave(struct ucred *cred, struct ptsc *pt, int n)
pty_create_slave(struct ucred *cred, struct ptsc *pt, int m)
{
int n;
n = minor2unit(m);
KASSERT(n >= 0 && n / 32 < sizeof(names),
("pty_create_slave: n %d ptsc %p", n, pt));
pt->devs = make_dev_cred(&pts_cdevsw, n, cred, UID_ROOT, GID_WHEEL,
pt->devs = make_dev_cred(&pts_cdevsw, m, cred, UID_ROOT, GID_WHEEL,
0666, "tty%c%r", names[n / 32], n % 32);
pt->devs->si_drv1 = pt;
pt->devs->si_tty = pt->pt_tty;
@ -352,7 +354,7 @@ ptcopen(struct cdev *dev, int flag, int devtype, struct thread *td)
pt->pt_ucntl = 0;
if (!pt->devs)
pty_create_slave(td->td_ucred, pt, minor2unit(minor(dev)));
pty_create_slave(td->td_ucred, pt, minor(dev));
pt->pt_devc_open = 1;
return (0);