]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34521: Fix FD transfer in multiprocessing on FreeBSD (GH-15422)
authorVictor Stinner <vstinner@redhat.com>
Fri, 23 Aug 2019 13:00:38 +0000 (14:00 +0100)
committerGitHub <noreply@github.com>
Fri, 23 Aug 2019 13:00:38 +0000 (14:00 +0100)
Fix file descriptors transfer in multiprocessing on FreeBSD: use
CMSG_SPACE() rather than CMSG_LEN(); see RFC 3542.

Misc/NEWS.d/next/Library/2019-08-23-14-47-09.bpo-34521.Y2BYu5.rst [new file with mode: 0644]
Modules/_multiprocessing/multiprocessing.c

diff --git a/Misc/NEWS.d/next/Library/2019-08-23-14-47-09.bpo-34521.Y2BYu5.rst b/Misc/NEWS.d/next/Library/2019-08-23-14-47-09.bpo-34521.Y2BYu5.rst
new file mode 100644 (file)
index 0000000..06f42a8
--- /dev/null
@@ -0,0 +1,2 @@
+Fix file descriptors transfer in multiprocessing on FreeBSD: use
+``CMSG_SPACE()`` rather than ``CMSG_LEN()``; see :rfc:`3542`.
index d192a074ba55c3734fcc08966a5e781582adedc0..eecace887e62707ab216dc7e0cd0b673ca3127bb 100644 (file)
@@ -167,7 +167,7 @@ multiprocessing_recvfd(PyObject *self, PyObject *args)
     cmsg = CMSG_FIRSTHDR(&msg);
     cmsg->cmsg_level = SOL_SOCKET;
     cmsg->cmsg_type = SCM_RIGHTS;
-    cmsg->cmsg_len = CMSG_LEN(sizeof(int));
+    cmsg->cmsg_len = CMSG_SPACE(sizeof(int));
     msg.msg_controllen = cmsg->cmsg_len;
 
     Py_BEGIN_ALLOW_THREADS