aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-03-15 16:21:37 +0000
committerBruce Momjian <bruce@momjian.us>2004-03-15 16:21:37 +0000
commitbda6e04ba070a84a124de0e6eeda52534cb4ed4c (patch)
tree46700b3b8edab71d66b4c89586df25c061568ec6 /src
parentf744c0f76018d7d9acac560c584a29e3eb828a45 (diff)
downloadpostgresql-bda6e04ba070a84a124de0e6eeda52534cb4ed4c.tar.gz
postgresql-bda6e04ba070a84a124de0e6eeda52534cb4ed4c.zip
Check for EOF on pipe differs under win32, as it is based on a socket
implementation. Claudio Natoli
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/pgstat.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 95cd52e6442..15cff4d144b 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.60 2004/03/10 21:12:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.61 2004/03/15 16:21:37 momjian Exp $
* ----------
*/
#include "postgres.h"
@@ -1642,6 +1642,7 @@ pgstat_mainChild(PGSTAT_FORK_ARGS)
*/
int nread = 0;
int targetlen = sizeof(PgStat_MsgHdr); /* initial */
+ bool pipeEOF = false;
while (nread < targetlen)
{
@@ -1652,13 +1653,23 @@ pgstat_mainChild(PGSTAT_FORK_ARGS)
{
if (errno == EINTR)
continue;
+#ifdef WIN32
+ if (WSAGetLastError() == WSAECONNRESET) /* EOF on the pipe! (win32 socket based implementation) */
+ {
+ pipeEOF = true;
+ break;
+ }
+#endif
ereport(LOG,
(errcode_for_socket_access(),
- errmsg("could not read from statistics collector pipe: %m")));
+ errmsg("could not read from statistics collector pipe: %m")));
exit(1);
}
if (len == 0) /* EOF on the pipe! */
+ {
+ pipeEOF = true;
break;
+ }
nread += len;
if (nread == sizeof(PgStat_MsgHdr))
{
@@ -1683,7 +1694,7 @@ pgstat_mainChild(PGSTAT_FORK_ARGS)
* EOF on the pipe implies that the buffer process exited.
* Fall out of outer loop.
*/
- if (len == 0)
+ if (pipeEOF)
break;
/*