From 6a1cf96b4a2dee29cf66887652e81ea2addc7821 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Wed, 23 Jul 2014 18:04:52 +0000 Subject: [PATCH] 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. MFC after: 1 week --- sys/kern/uipc_usrreq.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 6083983e779..4ef2e685e5d 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1853,7 +1853,7 @@ unp_internalize(struct mbuf **controlp, struct thread *td) 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, struct thread *td) */ 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;