Subj : src/xpdev/sockwrap.c To : Git commit to main/sbbs/master From : Rob Swindell (on Windows 11) Date : Sat May 02 2026 18:58:15 https://gitlab.synchro.net/main/sbbs/-/commit/9bb6aa39080f6af5c62a2166 Modified Files: src/xpdev/sockwrap.c Log Message: sockwrap: preserve WSAGetLastError() across socket_strerror() On Windows, FormatMessageA() shares its TLS slot with WSAGetLastError(), and calls SetLastError(ERROR_INSUFFICIENT_BUFFER) on a too-small buffer. Callers that reference SOCKET_ERRNO and SOCKET_STRERROR in the same printf-style call (e.g. main.cpp:2745, telgate.cpp:433) can therefore see a bogus normalized error code (e.g. -9878 from 122-WSABASEERR) when argument-evaluation order puts the SOCKET_STRERROR call first and the underlying message overflows the caller's buffer. Snapshot WSAGetLastError() at function entry and restore it before returning so the side-effect cannot leak. Co-Authored-By: Claude Opus 4.7 (1M context) --- þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net .