socket: check result of SO_NOSIGPIPE

New define USE_SO_NOSIGPIPE in curl_setup.h, for now set whenever
SO_NOSIGPIPE is defined. Maybe overridden in the future on systems where
this does not work.

With USE_SO_NOSIGPIPE defined, set SO_NOSIGPIPE on all sockets created
by libcurl and fail the creation when setsockopt() fails.

Closes #20370
This commit is contained in:
Stefan Eissing 2026-01-20 11:09:58 +01:00 committed by Daniel Stenberg
parent 0bef137fbd
commit 3dd7f5890f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 31 additions and 33 deletions

View file

@ -172,6 +172,9 @@ int main(int argc, char *argv[])
}
#if defined(HAVE_SIGNAL) && defined(SIGPIPE)
#ifdef DEBUGBUILD
if(!curl_getenv("CURL_SIGPIPE_DEBUG"))
#endif
(void)signal(SIGPIPE, SIG_IGN);
#endif