1111 *
1212 *
1313 * IDENTIFICATION
14- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.142 2000/05/24 00:14:25 momjian Exp $
14+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.143 2000/05/26 01:38:08 tgl Exp $
1515 *
1616 * NOTES
1717 *
@@ -1280,7 +1280,6 @@ ConnCreate(int serverFd)
12801280{
12811281Port * port ;
12821282
1283-
12841283if (!(port = (Port * )calloc (1 ,sizeof (Port ))))
12851284{
12861285fprintf (stderr ,"%s: ConnCreate: malloc failed\n" ,
@@ -1292,7 +1291,7 @@ ConnCreate(int serverFd)
12921291if (StreamConnection (serverFd ,port )!= STATUS_OK )
12931292{
12941293StreamClose (port -> sock );
1295- free (port );
1294+ ConnFree (port );
12961295port = NULL ;
12971296}
12981297else
@@ -1306,7 +1305,7 @@ ConnCreate(int serverFd)
13061305}
13071306
13081307/*
1309- * ConnFree --cree a local connection data structure
1308+ * ConnFree --free a local connection data structure
13101309 */
13111310static void
13121311ConnFree (Port * conn )
@@ -1891,8 +1890,10 @@ DoBackend(Port *port)
18911890/* Close the postmaster sockets */
18921891if (NetServer )
18931892StreamClose (ServerSock_INET );
1893+ ServerSock_INET = INVALID_SOCK ;
18941894#if !defined(__CYGWIN32__ )&& !defined(__QNX__ )
18951895StreamClose (ServerSock_UNIX );
1896+ ServerSock_UNIX = INVALID_SOCK ;
18961897#endif
18971898
18981899/* Save port etc. for ps status */
@@ -2024,10 +2025,13 @@ ExitPostmaster(int status)
20242025 */
20252026if (ServerSock_INET != INVALID_SOCK )
20262027StreamClose (ServerSock_INET );
2028+ ServerSock_INET = INVALID_SOCK ;
20272029#if !defined(__CYGWIN32__ )&& !defined(__QNX__ )
20282030if (ServerSock_UNIX != INVALID_SOCK )
20292031StreamClose (ServerSock_UNIX );
2032+ ServerSock_UNIX = INVALID_SOCK ;
20302033#endif
2034+
20312035proc_exit (status );
20322036}
20332037
@@ -2190,11 +2194,15 @@ SSDataBase(bool startup)
21902194char nbbuf [ARGV_SIZE ];
21912195char dbbuf [ARGV_SIZE ];
21922196
2197+ /* Lose the postmaster's on-exit routines and port connections */
21932198on_exit_reset ();
2199+
21942200if (NetServer )
21952201StreamClose (ServerSock_INET );
2202+ ServerSock_INET = INVALID_SOCK ;
21962203#if !defined(__CYGWIN32__ )&& !defined(__QNX__ )
21972204StreamClose (ServerSock_UNIX );
2205+ ServerSock_UNIX = INVALID_SOCK ;
21982206#endif
21992207
22002208StrNCpy (execbuf ,Execfile ,MAXPGPATH );