Fix fd passing on FreeBSD/amd64 and possibly Solaris/sparc.

The number of file descriptors in the message was not
determined correctly.
This commit is contained in:
Jilles Tjoelker 2009-07-10 00:27:01 +02:00
parent beccbe318c
commit 90e960f061

View file

@ -2156,7 +2156,7 @@ rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds
if(msg.msg_controllen > 0 && msg.msg_control != NULL
&& (cmsg = CMSG_FIRSTHDR(&msg)) != NULL)
{
rfds = (msg.msg_controllen - sizeof(struct cmsghdr)) / sizeof(int);
rfds = ((unsigned char *)cmsg + cmsg->cmsg_len - CMSG_DATA(cmsg)) / sizeof(int);
for(x = 0; x < nfds && x < rfds; x++)
{