summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_pty.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/tty_pty.c')
-rw-r--r--sys/kern/tty_pty.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 4e5f75aa1b9..4c9d665746f 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_pty.c,v 1.84 2018/04/28 03:13:04 visa Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.85 2018/06/02 10:27:43 mpi Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
@@ -1070,11 +1070,11 @@ ptmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
case PTMGET:
fdplock(fdp);
/* Grab two filedescriptors. */
- if ((error = falloc(p, 0, &cfp, &cindx)) != 0) {
+ if ((error = falloc(p, &cfp, &cindx)) != 0) {
fdpunlock(fdp);
break;
}
- if ((error = falloc(p, 0, &sfp, &sindx)) != 0) {
+ if ((error = falloc(p, &sfp, &sindx)) != 0) {
fdremove(fdp, cindx);
closef(cfp, p);
fdpunlock(fdp);
@@ -1166,11 +1166,12 @@ retry:
memcpy(ptm->cn, pti->pty_pn, sizeof(pti->pty_pn));
memcpy(ptm->sn, pti->pty_sn, sizeof(pti->pty_sn));
- /* mark the files mature now that we've passed all errors */
- FILE_SET_MATURE(cfp, p);
- FILE_SET_MATURE(sfp, p);
-
+ /* insert files now that we've passed all errors */
+ fdinsert(fdp, cindx, 0, cfp);
+ fdinsert(fdp, sindx, 0, sfp);
fdpunlock(fdp);
+ FRELE(cfp, p);
+ FRELE(sfp, p);
break;
default:
error = EINVAL;