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.
This commit is contained in:
parent
3b26f734c0
commit
c364221909
|
@ -0,0 +1,2 @@
|
||||||
|
Fix file descriptors transfer in multiprocessing on FreeBSD: use
|
||||||
|
``CMSG_SPACE()`` rather than ``CMSG_LEN()``; see :rfc:`3542`.
|
|
@ -167,7 +167,7 @@ multiprocessing_recvfd(PyObject *self, PyObject *args)
|
||||||
cmsg = CMSG_FIRSTHDR(&msg);
|
cmsg = CMSG_FIRSTHDR(&msg);
|
||||||
cmsg->cmsg_level = SOL_SOCKET;
|
cmsg->cmsg_level = SOL_SOCKET;
|
||||||
cmsg->cmsg_type = SCM_RIGHTS;
|
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;
|
msg.msg_controllen = cmsg->cmsg_len;
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
|
|
Loading…
Reference in New Issue