summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2012-06-11 19:53:41 +0000
committerpjd <pjd@FreeBSD.org>2012-06-11 19:53:41 +0000
commitcab8c2dc3aae7f1ca63d0c4fe8b5e0c87d02dad7 (patch)
treed36bc49a555875cee6e37a8cbbc3d646f68745de /sys/kern/kern_descrip.c
parentb903b5753dfa4750266fd0e1dd06ba451ad7076d (diff)
downloadFreeBSD-src-cab8c2dc3aae7f1ca63d0c4fe8b5e0c87d02dad7.zip
FreeBSD-src-cab8c2dc3aae7f1ca63d0c4fe8b5e0c87d02dad7.tar.gz
Merge two ifs into one to make the code almost identical to the code in
kern_close(). Discussed with: kib Tested by: pho MFC after: 1 month
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 65f7124..7c7bc34 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -892,24 +892,25 @@ do_dup(struct thread *td, int flags, int old, int new,
*
* XXX this duplicates parts of close().
*/
- holdleaders = 0;
- if (delfp != NULL && td->td_proc->p_fdtol != NULL) {
+ if (delfp != NULL) {
+ if (td->td_proc->p_fdtol != NULL) {
+ /*
+ * Ask fdfree() to sleep to ensure that all relevant
+ * process leaders can be traversed in closef().
+ */
+ fdp->fd_holdleaderscount++;
+ holdleaders = 1;
+ } else {
+ holdleaders = 0;
+ }
+
/*
- * Ask fdfree() to sleep to ensure that all relevant
- * process leaders can be traversed in closef().
+ * If we dup'd over a valid file, we now own the reference to it
+ * and must dispose of it using closef() semantics (as if a
+ * close() were performed on it).
+ *
+ * XXX this duplicates parts of close().
*/
- fdp->fd_holdleaderscount++;
- holdleaders = 1;
- }
-
- /*
- * If we dup'd over a valid file, we now own the reference to it
- * and must dispose of it using closef() semantics (as if a
- * close() were performed on it).
- *
- * XXX this duplicates parts of close().
- */
- if (delfp != NULL) {
knote_fdclose(td, new);
/*
* When we're closing an fd with a capability, we need to
OpenPOWER on IntegriCloud