> Seems system() call cleanups sigaction state on FreeBSD.
The root of problem is a threading library. In FreeBSD there are two versions of
sigaction() (system() and others) depending on thread enabled. libpq library is
compiled by default with -pthread switch but psql is linked without that.
This mixed linkage is a reason why system() call for external program loses
signal handler.
Next, configure script correctly sets PTHREAD_* variables but PTHREAD_LIBS is
not used for psql linking.
What is the best way to fix that? I suggest to add PTHREAD_LIBS to linking psql
at least. Although, suppose, it could be a reason for other cryptic bugs.
I didn't test this solution on other OSes, but, suppose, it will work.
--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/