diff options
author | mjg <mjg@FreeBSD.org> | 2014-08-17 07:24:23 +0000 |
---|---|---|
committer | mjg <mjg@FreeBSD.org> | 2014-08-17 07:24:23 +0000 |
commit | 75d88c0d5af7637b80b91ac5ad44544a638d5ea8 (patch) | |
tree | ed94951193bd4bcbeb34f986f03513404c0c433e | |
parent | fd678d23e5057af1b9ebf94bcd31fb03323560fd (diff) | |
download | FreeBSD-src-75d88c0d5af7637b80b91ac5ad44544a638d5ea8.zip FreeBSD-src-75d88c0d5af7637b80b91ac5ad44544a638d5ea8.tar.gz |
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.
-rw-r--r-- | sys/kern/uipc_usrreq.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 2736ade..3036c23 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; |