aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-misc.c
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1998-08-17 03:50:43 +0000
committerMarc G. Fournier <scrappy@hub.org>1998-08-17 03:50:43 +0000
commit93120330713916c28f87deb3466010b1f23a213e (patch)
treefc56a3e099f78a8f4d3b10a1c4fbfc1aba594099 /src/interfaces/libpq/fe-misc.c
parent3fa676a74cd7f4e010610e1da1bf17395b1d05c7 (diff)
downloadpostgresql-93120330713916c28f87deb3466010b1f23a213e.tar.gz
postgresql-93120330713916c28f87deb3466010b1f23a213e.zip
Date: Sun, 16 Aug 1998 14:56:48 -0400
From: Tom Lane <tgl@sss.pgh.pa.us> Attached is a patch for this weekend's work on libpq. I've dealt with several issues: <for details: see message, in pgsql-patches archive for above data>
Diffstat (limited to 'src/interfaces/libpq/fe-misc.c')
-rw-r--r--src/interfaces/libpq/fe-misc.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index 512633ca0fc..5608a0de2f8 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -24,15 +24,20 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.17 1998/08/09 02:59:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.18 1998/08/17 03:50:38 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
+#include "libpq-fe.h"
+#include "libpq-int.h"
+#include "postgres.h"
+#include "pqsignal.h"
+
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <signal.h>
#include <time.h>
#ifdef WIN32
#include "win32.h"
@@ -42,13 +47,11 @@
#include <unistd.h>
#endif
#endif /* WIN32 */
-#include <sys/types.h> /* for fd_set stuff */
+
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
-#include "postgres.h"
-#include "libpq-fe.h"
#define DONOTICE(conn,message) \
((*(conn)->noticeHook) ((conn)->noticeArg, (message)))
@@ -273,7 +276,7 @@ pqPutInt(int value, int bytes, PGconn *conn)
/* --------------------------------------------------------------------- */
/* pqReadReady: is select() saying the file is ready to read?
*/
-int
+static int
pqReadReady(PGconn *conn)
{
fd_set input_mask;
@@ -451,7 +454,17 @@ pqFlush(PGconn *conn)
while (len > 0)
{
+ /* Prevent being SIGPIPEd if backend has closed the connection. */
+#ifndef WIN32
+ pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN);
+#endif
+
int sent = send(conn->sock, ptr, len, 0);
+
+#ifndef WIN32
+ pqsignal(SIGPIPE, oldsighandler);
+#endif
+
if (sent < 0)
{
/* Anything except EAGAIN or EWOULDBLOCK is trouble */