From: Miroslav Lichvar Date: Thu, 28 Aug 2025 07:33:34 +0000 (+0200) Subject: test: fix socket unit test to use non-blocking accepted sockets X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=120bf44989391164c924e97d3142dc1352ab7970;p=thirdparty%2Fchrony.git test: fix socket unit test to use non-blocking accepted sockets SCK_AcceptConnection() always returns a non-blocking socket. Clear the O_NONBLOCK flag in the socket unit test, which relies on blocking, to avoid failures. Reported-by: Matthias Andree --- diff --git a/test/unit/socket.c b/test/unit/socket.c index 8630f382..e3db0742 100644 --- a/test/unit/socket.c +++ b/test/unit/socket.c @@ -191,6 +191,7 @@ test_unit(void) s3 = SCK_AcceptConnection(s1, &sa2); TEST_CHECK(UTI_CompareIPs(&sa1.ip_addr, &sa2.ip_addr, NULL) == 0); + fcntl(s3, F_SETFL, fcntl(s3, F_GETFL) & ~O_NONBLOCK); send_and_recv(SCK_ADDR_IP, 1, 1, s3, s2); SCK_ShutdownConnection(s2); @@ -227,6 +228,7 @@ test_unit(void) s3 = SCK_AcceptConnection(s1, &sa2); TEST_CHECK(sa2.ip_addr.family == IPADDR_UNSPEC); + fcntl(s3, F_SETFL, fcntl(s3, F_GETFL) & ~O_NONBLOCK); send_and_recv(SCK_ADDR_UNIX, 1, i % 2, s3, s2); if (i % 4)