Fix receiving fd over unix socket broken in r247740.

If n fds were passed, it would receive the first one n times.

Reported by:	Shawn Webb <lattera@gmail.com>, koobs, gleb
Tested by:	koobs, gleb
Reviewed by:	pjd
This commit is contained in:
Mateusz Guzik 2013-07-02 07:36:04 +00:00
parent 52d5f34490
commit a82a370603

View File

@ -1764,8 +1764,8 @@ unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags)
}
for (i = 0; i < newfds; i++, fdp++) {
fde = &fdesc->fd_ofiles[*fdp];
fde->fde_file = fdep[0]->fde_file;
filecaps_move(&fdep[0]->fde_caps,
fde->fde_file = fdep[i]->fde_file;
filecaps_move(&fdep[i]->fde_caps,
&fde->fde_caps);
if ((flags & MSG_CMSG_CLOEXEC) != 0)
fde->fde_flags |= UF_EXCLOSE;