Skip to content

Commit baac6f9

Browse files
committed
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...
1 parent 66f6634 commit baac6f9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/libpq/pqcomm.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
* Copyright (c) 1994, Regents of the University of California
3030
*
31-
* $Id: pqcomm.c,v 1.80 1999/07/17 20:17:03 momjian Exp $
31+
* $Id: pqcomm.c,v 1.81 1999/07/23 03:00:10 tgl Exp $
3232
*
3333
*-------------------------------------------------------------------------
3434
*/
@@ -134,12 +134,16 @@ pq_getport(void)
134134

135135
/* --------------------------------
136136
* pq_close - shutdown libpq at backend exit
137+
*
138+
* Note: in a standalone backend MyProcPort will be null,
139+
* don't crash during exit...
137140
* --------------------------------
138141
*/
139142
void
140143
pq_close(void)
141144
{
142-
close(MyProcPort->sock);
145+
if (MyProcPort != NULL)
146+
close(MyProcPort->sock);
143147
}
144148

145149

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy