]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Fix file descriptor passing on 64-bit FreeBSD and NetBSD.
authorBruno Haible <bruno@clisp.org>
Wed, 17 Feb 2021 02:47:56 +0000 (03:47 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 17 Feb 2021 10:15:33 +0000 (10:15 +0000)
* src/util/virsocket.c (virSocketRecvFD): Set msg.msg_controllen as documented
in the man pages.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/util/virsocket.c

index c8435a108784989aa93379ad4269564b853eb9e0..b971da16e3737bc453f2fa38d5533a8d60ea0a52 100644 (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)