summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_pts.c
diff options
context:
space:
mode:
authorcognet <cognet@FreeBSD.org>2006-01-26 20:54:49 +0000
committercognet <cognet@FreeBSD.org>2006-01-26 20:54:49 +0000
commit998c2ee892689a421b718d82f1773f89f0c0043e (patch)
tree4ac5399262a11c790573ea69db84506ca2d82bc2 /sys/kern/tty_pts.c
parent8d30a9e919676913a7c5c33b7bff8a00c70cecbf (diff)
downloadFreeBSD-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/kern/tty_pts.c')
-rw-r--r--sys/kern/tty_pts.c8
1 files changed, 6 insertions, 2 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;
OpenPOWER on IntegriCloud