diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2018-06-26 14:43:02 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2018-06-26 14:43:02 +0000 |
commit | 089901f02b883bce702f141dfdc5f8ccb7398fdd (patch) | |
tree | c3fd031f5a72ff8e392f61d6958a9f8bcf1e7889 /sys | |
parent | 6f8b749f5942125cc198f7f3af0226307ea26114 (diff) |
Remove a duplicate fd_used() call. The new file descriptor passed
to dupfdopen() has already been registered with fd_used() in fdalloc().
The duplicate call distorted the number of open file descriptors
returned by getdtablecount(2) if a file was opened via /dev/fd/.
While there, assert that the file instance should already be in the
file list.
OK mpi@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_descrip.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 9277c4f9e10..38198c17288 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.170 2018/06/25 22:29:16 kettenis Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.171 2018/06/26 14:43:01 visa Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -1377,10 +1377,11 @@ dupfdopen(struct proc *p, int indx, int mode) return (EDEADLK); } + KASSERT(wfp->f_iflags & FIF_INSERTED); fdp->fd_ofiles[indx] = wfp; fdp->fd_ofileflags[indx] = (fdp->fd_ofileflags[indx] & UF_EXCLOSE) | (fdp->fd_ofileflags[dupfd] & ~UF_EXCLOSE); - fd_used(fdp, indx); + return (0); } |