summaryrefslogtreecommitdiff
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 7ead57404e6..cb4b4143361 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.87 2011/07/08 19:28:36 otto Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.88 2011/07/08 21:26:27 matthew Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -313,6 +313,7 @@ restart:
switch (SCARG(uap, cmd)) {
case F_DUPFD:
+ case F_DUPFD_CLOEXEC:
newmin = (long)SCARG(uap, arg);
if ((u_int)newmin >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur ||
(u_int)newmin >= maxfiles) {
@@ -334,6 +335,9 @@ restart:
else
FRELE(fp);
+ if (!error && SCARG(uap, cmd) == F_DUPFD_CLOEXEC)
+ fdp->fd_ofileflags[i] |= UF_EXCLOSE;
+
fdpunlock(fdp);
return (error);