summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2018-06-02 12:42:19 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2018-06-02 12:42:19 +0000
commit88d519fe9276317e97cad55689dcc3a04b162727 (patch)
tree4c57dd917186cc7ac3dfa4c6d9a882a39066dbab /sys/kern
parent9da4da23edb60b746708dad8fac8845ad7f2817b (diff)
Add an assert that makes explicit that finishdup() should receive
an inserted fp. OK mpi@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_descrip.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index b8bd3886e52..b6a33dafdc8 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.162 2018/06/02 10:27:43 mpi Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.163 2018/06/02 12:42:18 visa Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -637,6 +637,8 @@ finishdup(struct proc *p, struct file *fp, int old, int new,
struct filedesc *fdp = p->p_fd;
fdpassertlocked(fdp);
+ KASSERT(fp->f_iflags & FIF_INSERTED);
+
if (fp->f_count == LONG_MAX-2) {
FRELE(fp, p);
return (EDEADLK);