Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2012 19:53:42 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236912 - head/sys/kern
Message-ID:  <201206111953.q5BJrgXd006562@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206111953.q5BJrgXd006562>