--- trealla-3.15.28/src/network.c.orig 2026-11-22 02:35:18.000000000 +0100 +++ trealla-3.15.28/src/network.c 2026-11-22 11:17:33.395811254 +0100 @@ -4,6 +4,9 @@ #include #include #include +#include +#include +#include // Cosmopolitan produces one binary that runs both hosted (Linux/Mac/Windows, // with a real network stack) and booted directly with no OS at all - and @@ -514,8 +517,8 @@ ioctlsocket(SOCK_OF(fileno(str->fp_in)), FIONBIO, &flag); str->sock_nb = true; #elif !defined(__wasi__) - int flag = 1; // an int, as FIONBIO reads: an unsigned long's first bytes are 0 on 64-bit big-endian - ioctl(fileno(str->fp_in), FIONBIO, &flag); + int flags = fcntl(fileno(str->fp_in), F_GETFL, 0); + fcntl(fileno(str->fp_in), F_SETFL, flags | O_NONBLOCK); str->sock_nb = true; #endif }