Don't attempt to re-create the /dev entry for the slave part if it already

exist when opening the master. This can happen if one open the master, then
open the slave, then close and re-open the master.

Reported by:	Peter Holm
This commit is contained in:
Olivier Houchard 2006-01-26 20:54:49 +00:00
parent 3acb8d3f94
commit 169c44907a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154868
2 changed files with 8 additions and 3 deletions

View File

@ -444,8 +444,12 @@ ptcopen(struct cdev *dev, int flag, int devtype, struct thread *td)
* XXX: Might want to make the ownership/permissions here more
* configurable.
*/
pt->pt_devs = devs = make_dev_cred(&pts_cdevsw, pt->pt_num,
td->td_ucred, UID_ROOT, GID_WHEEL, 0666, "pts/%d", pt->pt_num);
if (pt->pt_devs)
devs = pt->pt_devs;
else
pt->pt_devs = devs = make_dev_cred(&pts_cdevsw, pt->pt_num,
td->td_ucred, UID_ROOT, GID_WHEEL, 0666, "pts/%d",
pt->pt_num);
devs->si_drv1 = pt;
devs->si_tty = pt->pt_tty;
pt->pt_tty->t_dev = devs;

View File

@ -327,7 +327,8 @@ ptcopen(struct cdev *dev, int flag, int devtype, struct thread *td)
pt->pt_send = 0;
pt->pt_ucntl = 0;
pty_create_slave(td->td_ucred, pt, minor(dev));
if (!pt->devs)
pty_create_slave(td->td_ucred, pt, minor(dev));
pt->pt_devc_open = 1;
return (0);