Subj : src/xpdev/multisock.c sockwrap.h To : Git commit to main/sbbs/master From : Rob Swindell (on Debian Linux) Date : Fri Aug 07 2026 16:23:26 https://gitlab.synchro.net/main/sbbs/-/commit/b96da4eb924aa5ac3da6302c Modified Files: src/xpdev/multisock.c sockwrap.h Log Message: Create listen sockets close-on-exec atomically where possible (#1174) 0db85afb4c (social-29-army, 2026-08-07) set FD_CLOEXEC with fcntl() after socket() returns, which leaves a window: a fork/exec on another thread during those few instructions still hands the descriptor to the child. Rare, but the bug it fixes was already rare. Most POSIX platforms can ask for the flag at creation time and close the window entirely. XP_SOCK_CLOEXEC is that flag where one exists and 0 where none does, so the socket() call needs no per-platform spelling, and the fcntl() stays unconditional rather than becoming a branch that compiles on one platform and is therefore never built anywhere else. Where the creation flag worked the fcntl() is a redundant no-op; where there is none (macOS) it remains the only protection, and still racy there. It lives in sockwrap.h rather than multisock.c so that accept4() and the long-lived open() call sites can use the same spelling when those are audited. Suggested by Deuce. Co-Authored-By: Claude Opus 5 (1M context) --- SBBSecho 3.37-Linux * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705) .