mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-05 06:45:06 -05:00
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 <matthias.andree@gmx.de>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user