Author: pjd
Date: Mon Jun 11 19:53:41 2012
New Revision: 236912
URL: http://svn.freebsd.org/changeset/base/236912

Log:
  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

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c        Mon Jun 11 19:51:27 2012        
(r236911)
+++ head/sys/kern/kern_descrip.c        Mon Jun 11 19:53:41 2012        
(r236912)
@@ -892,24 +892,25 @@ do_dup(struct thread *td, int flags, int
         *
         * 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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to