aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 233d3a2fe16..1086fd76320 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.266 2004/01/07 18:56:29 neilc Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.267 2004/01/09 02:02:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,6 +43,10 @@
#include <arpa/inet.h>
#endif
+#ifdef ENABLE_THREAD_SAFETY
+#include <pthread.h>
+#endif
+
#include "libpq/ip.h"
#include "mb/pg_wchar.h"
@@ -66,7 +70,6 @@ long ioctlsocket_ret=1;
#define DefaultSSLMode "disable"
#endif
-
/* ----------
* Definition of the conninfo parameters and their fallback resources.
*
@@ -198,6 +201,7 @@ static char *pwdfMatchesString(char *buf, char *token);
static char *PasswordFromFile(char *hostname, char *port, char *dbname,
char *username);
+
/*
* Connecting to a Database
*
@@ -881,6 +885,12 @@ connectDBStart(PGconn *conn)
struct addrinfo hint;
const char *node = NULL;
int ret;
+#ifdef ENABLE_THREAD_SAFETY
+ static pthread_once_t check_sigpipe_once = PTHREAD_ONCE_INIT;
+
+ /* Check only on first connection request */
+ pthread_once(&check_sigpipe_once, check_sigpipe_handler);
+#endif
if (!conn)
return 0;
@@ -3158,3 +3168,4 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
#undef LINELEN
}
+