Avoid extra system calls to block SIGPIPE if the platform provides either
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 24 Jul 2009 17:58:31 +0000 (17:58 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 24 Jul 2009 17:58:31 +0000 (17:58 +0000)
commitf5e41627ff1f1c09c30d9023fe13a9443de45f98
treea17a1339f5fc927bcc8d16a860525bac97a13ea2
parent6668c08372e253f1bf4ff9a4e1994f49a701556f
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
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-secure.c
src/interfaces/libpq/libpq-int.h