diff options
author | cognet <cognet@FreeBSD.org> | 2006-01-26 20:54:49 +0000 |
---|---|---|
committer | cognet <cognet@FreeBSD.org> | 2006-01-26 20:54:49 +0000 |
commit | 998c2ee892689a421b718d82f1773f89f0c0043e (patch) | |
tree | 4ac5399262a11c790573ea69db84506ca2d82bc2 /sys | |
parent | 8d30a9e919676913a7c5c33b7bff8a00c70cecbf (diff) | |
download | FreeBSD-src-998c2ee892689a421b718d82f1773f89f0c0043e.zip FreeBSD-src-998c2ee892689a421b718d82f1773f89f0c0043e.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/tty_pts.c | 8 | ||||
-rw-r--r-- | sys/kern/tty_pty.c | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c index 2f409b7..19a12c0 100644 --- a/sys/kern/tty_pts.c +++ b/sys/kern/tty_pts.c @@ -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; diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 643f0c4..2cc1d0f 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -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); |