Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Aug 2014 07:24:23 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r270094 - stable/10/sys/kern
Message-ID:  <201408170724.s7H7ONCM045044@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sun Aug 17 07:24:23 2014
New Revision: 270094
URL: http://svnweb.freebsd.org/changeset/base/270094

Log:
  MFC r269020:
  
  Cosmetic changes to unp_internalize
  
  Don't throw away the result of fget_unlocked.
  Move fdp increment to for loop to make it consistent with similar code
  elsewhere.

Modified:
  stable/10/sys/kern/uipc_usrreq.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/uipc_usrreq.c
==============================================================================
--- stable/10/sys/kern/uipc_usrreq.c	Sun Aug 17 07:22:40 2014	(r270093)
+++ stable/10/sys/kern/uipc_usrreq.c	Sun Aug 17 07:24:23 2014	(r270094)
@@ -1853,7 +1853,7 @@ unp_internalize(struct mbuf **controlp, 
 	struct filedescent *fde, **fdep, *fdev;
 	struct file *fp;
 	struct timeval *tv;
-	int i, fd, *fdp;
+	int i, *fdp;
 	void *data;
 	socklen_t clen = control->m_len, datalen;
 	int error, oldfds;
@@ -1906,14 +1906,13 @@ unp_internalize(struct mbuf **controlp, 
 			 */
 			fdp = data;
 			FILEDESC_SLOCK(fdesc);
-			for (i = 0; i < oldfds; i++) {
-				fd = *fdp++;
-				if (fget_locked(fdesc, fd) == NULL) {
+			for (i = 0; i < oldfds; i++, fdp++) {
+				fp = fget_locked(fdesc, *fdp);
+				if (fp == NULL) {
 					FILEDESC_SUNLOCK(fdesc);
 					error = EBADF;
 					goto out;
 				}
-				fp = fdesc->fd_ofiles[fd].fde_file;
 				if (!(fp->f_ops->fo_flags & DFLAG_PASSABLE)) {
 					FILEDESC_SUNLOCK(fdesc);
 					error = EOPNOTSUPP;



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