From 4ee5ade866c674ccc43a21f277c0bdb0f807beb7 Mon Sep 17 00:00:00 2001 From: Torrekie Gen Date: Mon, 8 Apr 2024 21:10:25 +0800 Subject: [PATCH] Fix Darwin sockets nonblocking Co-authored-by: Weijia Wang Signed-off-by: Torrekie Gen --- tests/display-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/display-test.c b/tests/display-test.c index c2def444..1e0b389f 100644 --- a/tests/display-test.c +++ b/tests/display-test.c @@ -39,6 +39,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + #include #include @@ -1499,6 +1503,10 @@ send_overflow_client(void *data) /* Limit the send buffer size for the display socket to guarantee * that the test will cause an overflow. */ sock = wl_display_get_fd(c->wl_display); +#if __APPLE__ + /* Darwin sockets may by non-blocked after accept() */ + assert(fcntl(sock, F_SETFL, ~O_NONBLOCK) != -1); +#endif assert(setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)) == 0); /* Request to break out of 'display_run' in the main process */