Skip to content

Commit fe48b6d

Browse files
Fix tests in test_socket to use correctly CMSG_LEN (GH-9594)
After some failures in AMD64 FreeBSD CURRENT Debug 3.x buildbots regarding tests in test_socket that are using testFDPassSeparateMinSpace(), FreeBDS revision 337423 was pointed out to be the reason the test started to fail. A close examination of the manpage for cmsg_space(3) reveals that the number of file descriptors needs to be taken into account when using CMSG_LEN(). This commit fixes tests in test_socket to use correctly CMSG_LEN, taking into account the number of FDs. (cherry picked from commit 7291108) Co-authored-by: Pablo Galindo <[email protected]>
1 parent 3a4aa6a commit fe48b6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_socket.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,10 +2858,11 @@ def _testFDPassSeparate(self):
28582858
def testFDPassSeparateMinSpace(self):
28592859
# Pass two FDs in two separate arrays, receiving them into the
28602860
# minimum space for two arrays.
2861-
self.checkRecvmsgFDs(2,
2861+
num_fds = 2
2862+
self.checkRecvmsgFDs(num_fds,
28622863
self.doRecvmsg(self.serv_sock, len(MSG),
28632864
socket.CMSG_SPACE(SIZEOF_INT) +
2864-
socket.CMSG_LEN(SIZEOF_INT)),
2865+
socket.CMSG_LEN(SIZEOF_INT * num_fds)),
28652866
maxcmsgs=2, ignoreflags=socket.MSG_CTRUNC)
28662867

28672868
@testFDPassSeparateMinSpace.client_skip

0 commit comments

Comments
 (0)