fix for passfd on 64-bit BSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>.

Bruno
>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)
-- 
2.7.4


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux