Avoid extra system calls to block SIGPIPE if the platform provides either

Tom Lane <tgl@sss.pgh.pa.us>

Commit: cea80e726edd42a39bb0220290738f7825de8e57
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2009-07-24T17:58:31Z
Releases: 9.0.0
Avoid extra system calls to block SIGPIPE if the platform provides either
sockopt(SO_NOSIGPIPE) or the MSG_NOSIGNAL flag to send().

We assume these features are available if (1) the symbol is defined at
compile time and (2) the kernel doesn't reject the call at runtime.
It might turn out that there are some platforms where (1) and (2) are
true and yet the signal isn't really blocked, in which case applications
would die on server crash.  If that sort of thing gets reported, then
we'll have to add additional defenses of some kind.

Jeremy Kerr

Files

PathChange+/−
src/interfaces/libpq/fe-connect.c modified +42 −2
src/interfaces/libpq/fe-secure.c modified +106 −37
src/interfaces/libpq/libpq-int.h modified +3 −1