Commit baac6f98 authored by Tom Lane's avatar Tom Lane

Exit cleanups I made yesterday caused pq_close() to be

invoked during exit from a standalone backend, leading to core dump.
This is the cause of the recently reported initdb-time crash :-(.
Sorry folks...
parent 66f66343
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: pqcomm.c,v 1.80 1999/07/17 20:17:03 momjian Exp $ * $Id: pqcomm.c,v 1.81 1999/07/23 03:00:10 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -134,12 +134,16 @@ pq_getport(void) ...@@ -134,12 +134,16 @@ pq_getport(void)
/* -------------------------------- /* --------------------------------
* pq_close - shutdown libpq at backend exit * pq_close - shutdown libpq at backend exit
*
* Note: in a standalone backend MyProcPort will be null,
* don't crash during exit...
* -------------------------------- * --------------------------------
*/ */
void void
pq_close(void) pq_close(void)
{ {
close(MyProcPort->sock); if (MyProcPort != NULL)
close(MyProcPort->sock);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment