util: Fix file descriptor passing on 64-bit FreeBSD and NetBSD.

* src/util/virsocket.c (virSocketRecvFD): Set msg.msg_controllen as documented
in the man pages.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Bruno Haible 2021-02-17 03:47:56 +01:00 committed by Daniel P. Berrangé
parent f1157ee530
commit 66611bc0df

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2020 Red Hat, Inc.
* Copyright (C) 2011-2020 Free Software Foundation, Inc.
* Copyright (C) 2011-2021 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -457,7 +457,7 @@ virSocketRecvFD(int sock, int fdflags)
cmsg->cmsg_len = CMSG_LEN(sizeof(fd));
/* Initialize the payload: */
memcpy(CMSG_DATA(cmsg), &fd, sizeof(fd));
msg.msg_controllen = cmsg->cmsg_len;
msg.msg_controllen = CMSG_SPACE(sizeof(fd));
len = recvmsg(sock, &msg, fdflags_recvmsg);
if (len < 0)