Skip to content

Commit c364221

Browse files
authored
bpo-34521: Fix FD transfer in multiprocessing on FreeBSD (GH-15422)
Fix file descriptors transfer in multiprocessing on FreeBSD: use CMSG_SPACE() rather than CMSG_LEN(); see RFC 3542.
1 parent 3b26f73 commit c364221

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix file descriptors transfer in multiprocessing on FreeBSD: use
2+
``CMSG_SPACE()`` rather than ``CMSG_LEN()``; see :rfc:`3542`.

Modules/_multiprocessing/multiprocessing.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ multiprocessing_recvfd(PyObject *self, PyObject *args)
167167
cmsg = CMSG_FIRSTHDR(&msg);
168168
cmsg->cmsg_level = SOL_SOCKET;
169169
cmsg->cmsg_type = SCM_RIGHTS;
170-
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
170+
cmsg->cmsg_len = CMSG_SPACE(sizeof(int));
171171
msg.msg_controllen = cmsg->cmsg_len;
172172

173173
Py_BEGIN_ALLOW_THREADS

0 commit comments

Comments
 (0)