Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd4e2759

Browse files
committed
More paranoia about global variables containing references to long-
since-closed file descriptors...
1 parent2af53f3 commitd4e2759

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
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
{
12811281
Port*port;
12821282

1283-
12841283
if (!(port= (Port*)calloc(1,sizeof(Port))))
12851284
{
12861285
fprintf(stderr,"%s: ConnCreate: malloc failed\n",
@@ -1292,7 +1291,7 @@ ConnCreate(int serverFd)
12921291
if (StreamConnection(serverFd,port)!=STATUS_OK)
12931292
{
12941293
StreamClose(port->sock);
1295-
free(port);
1294+
ConnFree(port);
12961295
port=NULL;
12971296
}
12981297
else
@@ -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
*/
13111310
staticvoid
13121311
ConnFree(Port*conn)
@@ -1891,8 +1890,10 @@ DoBackend(Port *port)
18911890
/* Close the postmaster sockets */
18921891
if (NetServer)
18931892
StreamClose(ServerSock_INET);
1893+
ServerSock_INET=INVALID_SOCK;
18941894
#if !defined(__CYGWIN32__)&& !defined(__QNX__)
18951895
StreamClose(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
*/
20252026
if (ServerSock_INET!=INVALID_SOCK)
20262027
StreamClose(ServerSock_INET);
2028+
ServerSock_INET=INVALID_SOCK;
20272029
#if !defined(__CYGWIN32__)&& !defined(__QNX__)
20282030
if (ServerSock_UNIX!=INVALID_SOCK)
20292031
StreamClose(ServerSock_UNIX);
2032+
ServerSock_UNIX=INVALID_SOCK;
20302033
#endif
2034+
20312035
proc_exit(status);
20322036
}
20332037

@@ -2190,11 +2194,15 @@ SSDataBase(bool startup)
21902194
charnbbuf[ARGV_SIZE];
21912195
chardbbuf[ARGV_SIZE];
21922196

2197+
/* Lose the postmaster's on-exit routines and port connections */
21932198
on_exit_reset();
2199+
21942200
if (NetServer)
21952201
StreamClose(ServerSock_INET);
2202+
ServerSock_INET=INVALID_SOCK;
21962203
#if !defined(__CYGWIN32__)&& !defined(__QNX__)
21972204
StreamClose(ServerSock_UNIX);
2205+
ServerSock_UNIX=INVALID_SOCK;
21982206
#endif
21992207

22002208
StrNCpy(execbuf,Execfile,MAXPGPATH);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp