On Wed, Feb 17, 2021 at 03:54:36AM +0100, Bruno Haible wrote: > Hi, > > Since libvirt has a clone of gnulib's passfd module in libvirt, find attached > a port of the recent fix > <https://lists.gnu.org/archive/html/bug-gnulib/2021-02/msg00066.html>. Thanks for taking the time to send us a patch ! > From d7e64f40c41fd6a95e3187de7bf37800f63a6b4e Mon Sep 17 00:00:00 2001 > From: Bruno Haible <bruno@xxxxxxxxx> > Date: Wed, 17 Feb 2021 03:47:56 +0100 > Subject: [PATCH] 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. > --- > src/util/virsocket.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/util/virsocket.c b/src/util/virsocket.c > index c8435a1..b971da1 100644 > --- a/src/util/virsocket.c > +++ b/src/util/virsocket.c > @@ -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) Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|