diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-07-23 03:00:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-07-23 03:00:10 +0000 |
commit | baac6f981e1ad58709403d4469eab9c8f5afc442 (patch) | |
tree | 4a419195cdf2748c1dccfd12e96622e1b80ca696 /src | |
parent | 66f66343f67b4873b058f42c405b04465710c9fe (diff) | |
download | postgresql-baac6f981e1ad58709403d4469eab9c8f5afc442.tar.gz postgresql-baac6f981e1ad58709403d4469eab9c8f5afc442.zip |
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...
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/libpq/pqcomm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index e8361b85353..5e129bc56ff 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -28,7 +28,7 @@ * * 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) /* -------------------------------- * pq_close - shutdown libpq at backend exit + * + * Note: in a standalone backend MyProcPort will be null, + * don't crash during exit... * -------------------------------- */ void pq_close(void) { - close(MyProcPort->sock); + if (MyProcPort != NULL) + close(MyProcPort->sock); } |