Godot Engine – Multi-platform 2D and 3D game engine
[macOS] Add SO_ERROR check to NetSocketUnix inet connect.
Pāvels Nadtočajevsd4644ff602c9
diff --git a/drivers/unix/net_socket_unix.cpp b/drivers/unix/net_socket_unix.cppindex 01cd55776f7..ed60465fe13 100644--- a/drivers/unix/net_socket_unix.cpp+++ b/drivers/unix/net_socket_unix.cpp@@ -466,8 +466,17 @@ Error NetSocketUnix::_inet_connect_to_host(IPAddress p_host, uint16_t p_port) {switch (err) {// We are already connected.- case ERR_NET_IS_CONNECTED:+ case ERR_NET_IS_CONNECTED: {+#if defined(APPLE_EMBEDDED_ENABLED) || defined(MACOS_ENABLED)+ // macOS 27 can return EISCONN when ::connect retry has failed, check SO_ERROR in addition.+ int so_error = 0;+ socklen_t so_error_len = sizeof(so_error);+ int ret = ::getsockopt(_sock, SOL_SOCKET, SO_ERROR, &so_error, &so_error_len);+ return (ret == 0 && so_error == 0) ? OK : FAILED;+#elsereturn OK;+#endif+ } break;// Still waiting to connect, try again in a while.case ERR_NET_WOULD_BLOCK:case ERR_NET_IN_PROGRESS: