https://gitlab.synchro.net/main/sbbs/-/commit/1823d0fa5d5ffb9676354d4a
Modified Files:
src/sbbs3/js_socket.h src/xpdev/sockwrap.c
Log Message:
Fix "Error 122 getting error description" from socket_strerror() on Windows
A JavaScript Socket connect timeout logged:
Oneliners error: Error: 60 connecting to TCP port 10088 on server
localhost: Error 122 getting error description
122 is ERROR_INSUFFICIENT_BUFFER: FormatMessageA() fails outright, rather
than truncating, when the error description doesn't fit the caller's
buffer. js_socket_private_t's last_error_str is only 128 bytes (added in 6a5cf7f6b9, 2024-02-24) and WSAETIMEDOUT's description is 182, so every
socket timeout surfaced to JavaScript reported the placeholder instead of
the reason. WSAECONNREFUSED (74 bytes) fits, which is why only timeouts
showed it.
Widen last_error_str to SOCKET_STRERROR_BUFLEN. 6bb7c59327 (2026-05-02)
swept the socket_strerror() call sites to that constant, but enumerated
only those passing a local buffer and so missed this one inside a struct;
it also put the longest description at ~135 bytes, which WSAETIMEDOUT
exceeds.
Also let FormatMessage allocate its own buffer and copy the result into
the caller's, so a short buffer yields a truncated description rather
than the useless placeholder.
Co-Authored-By: Claude Opus 5 (1M context) <
noreply@anthropic.com> Claude-Session:
https://claude.ai/code/session_01TqPdzXdWBszEtX8WjSfwMJ
--- SBBSecho 3.37-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)