Files
codebase-memory-mcp/src/ui
Andrew Hundt ce987ad6d4 fix(ui): close HTTP sockets across exec
Create the graph UI listener with SOCK_CLOEXEC on Linux and accept connections with accept4(SOCK_CLOEXEC). Verify FD_CLOEXEC through ensure_socket_close_on_exec(), using checked fcntl fallback handling on POSIX platforms such as macOS; close and reject a socket when the invariant cannot be established. Windows retains its non-inheritable SOCKET behavior.

Expose cbm_httpd_listener_close_on_exec() and cbm_http_conn_close_on_exec() in src/ui/httpd.h so tests can assert the opaque transport lifecycle contract. Add listener and accepted-connection coverage in tests/test_httpd.c.

Validation: CBM_ONLY_SUITE=httpd build/c/test-runner: 44 passed, 1 Windows-only skip under ASan/UBSan. scripts/check-source-safety.sh: passed.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
2026-07-14 05:33:30 -04:00
..