mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Back out incorrect commit.
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.68 2005/08/23 20:45:07 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.69 2005/08/23 20:48:47 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* [ Most of these notes are wrong/obsolete, but perhaps not all ]
|
||||
@ -103,12 +103,8 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef ENABLE_THREAD_SAFETY
|
||||
#ifdef WIN32
|
||||
#include "pthread-win32.h"
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRDUP
|
||||
#include "strdup.h"
|
||||
@ -392,21 +388,20 @@ ssize_t
|
||||
pqsecure_write(PGconn *conn, const void *ptr, size_t len)
|
||||
{
|
||||
ssize_t n;
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#ifdef ENABLE_THREAD_SAFETY
|
||||
sigset_t osigmask;
|
||||
bool sigpipe_pending;
|
||||
bool got_epipe = false;
|
||||
|
||||
|
||||
if (pq_block_sigpipe(&osigmask, &sigpipe_pending) < 0)
|
||||
return -1;
|
||||
#else
|
||||
#ifndef WIN32
|
||||
pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN);
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
#endif /* WIN32 */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_SSL
|
||||
if (conn->ssl)
|
||||
{
|
||||
@ -436,7 +431,7 @@ pqsecure_write(PGconn *conn, const void *ptr, size_t len)
|
||||
|
||||
if (n == -1)
|
||||
{
|
||||
#if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32)
|
||||
#ifdef ENABLE_THREAD_SAFETY
|
||||
if (SOCK_ERRNO == EPIPE)
|
||||
got_epipe = true;
|
||||
#endif
|
||||
@ -478,19 +473,19 @@ pqsecure_write(PGconn *conn, const void *ptr, size_t len)
|
||||
#endif
|
||||
{
|
||||
n = send(conn->sock, ptr, len, 0);
|
||||
#if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32)
|
||||
#ifdef ENABLE_THREAD_SAFETY
|
||||
if (n < 0 && SOCK_ERRNO == EPIPE)
|
||||
got_epipe = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#ifdef ENABLE_THREAD_SAFETY
|
||||
pq_reset_sigpipe(&osigmask, sigpipe_pending, got_epipe);
|
||||
#else
|
||||
#ifndef WIN32
|
||||
pqsignal(SIGPIPE, oldsighandler);
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
#endif /* WIN32 */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return n;
|
||||
}
|
||||
@ -1237,7 +1232,7 @@ PQgetssl(PGconn *conn)
|
||||
|
||||
#endif /* USE_SSL */
|
||||
|
||||
#if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32)
|
||||
#ifdef ENABLE_THREAD_SAFETY
|
||||
|
||||
/*
|
||||
* Block SIGPIPE for this thread. This prevents send()/write() from exiting
|
||||
|
Reference in New Issue
Block a user